diff options
author | Squibid <me@zacharyscheiman.com> | 2025-05-08 18:18:34 -0500 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2025-05-08 18:18:34 -0500 |
commit | 7430ebed8eab0364452a6cdcaa209f8a7288e44d (patch) | |
tree | cd80b99c41c4af92c7a130fe52ca462062697d22 /lua/conf/plugins/dap-vtxt.lua | |
parent | 7c3289fded1f75f6e060f56bd06edc2a327744d9 (diff) | |
download | nvim-7430ebed8eab0364452a6cdcaa209f8a7288e44d.tar.gz nvim-7430ebed8eab0364452a6cdcaa209f8a7288e44d.tar.bz2 nvim-7430ebed8eab0364452a6cdcaa209f8a7288e44d.zip |
kitchen sink now don't support any version lower than 0.11.0 for lspv3.0
- dap now works for java and c
Diffstat (limited to 'lua/conf/plugins/dap-vtxt.lua')
-rw-r--r-- | lua/conf/plugins/dap-vtxt.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lua/conf/plugins/dap-vtxt.lua b/lua/conf/plugins/dap-vtxt.lua new file mode 100644 index 0000000..30b2632 --- /dev/null +++ b/lua/conf/plugins/dap-vtxt.lua @@ -0,0 +1,27 @@ +return { "theHamsta/nvim-dap-virtual-text", + requires = { + "nvim-treesitter/nvim-treesitter", + "mfussenegger/nvim-dap" + }, + function() + require("nvim-dap-virtual-text").setup { + virt_text_pos = vim.fn.has("nvim-0.10") == 1 and "inline" or "eol", + + --- A callback that determines how a variable is displayed or whether it should be omitted + --- @param variable Variable https://microsoft.github.io/debug-adapter-protocol/specification#Types_Variable + --- @param buf number + --- @param stackframe dap.StackFrame https://microsoft.github.io/debug-adapter-protocol/specification#Types_StackFrame + --- @param node userdata tree-sitter node identified as variable definition of reference (see `:h tsnode`) + --- @param options nvim_dap_virtual_text_options Current options for nvim-dap-virtual-text + --- @return string|nil A text how the virtual text should be displayed or nil, if this variable shouldn't be displayed + display_callback = function(variable, buf, stackframe, node, options) + -- by default, strip out new line characters + if options.virt_text_pos == "inline" then + return " = "..variable.value:gsub("%s+", " ") + else + return variable.name.." = "..variable.value:gsub("%s+", " ") + end + end + } + end +} |