28 lines
1.3 KiB
Lua
28 lines
1.3 KiB
Lua
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
|
|
}
|