From 7430ebed8eab0364452a6cdcaa209f8a7288e44d Mon Sep 17 00:00:00 2001 From: Squibid Date: Thu, 8 May 2025 18:18:34 -0500 Subject: kitchen sink now don't support any version lower than 0.11.0 for lsp - dap now works for java and c --- lua/conf/plugins/dap-vtxt.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 lua/conf/plugins/dap-vtxt.lua (limited to 'lua/conf/plugins/dap-vtxt.lua') 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 +} -- cgit v1.2.1