This plugin adds virtual text support to nvim-dap. nvim-treesitter is used to find variable definitions.
Plug 'mfussenegger/nvim-dap'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'theHamsta/nvim-dap-virtual-text'
The hlgroup for the virtual text is NvimDapVirtualText
(linked to Comment
).
The behavior of this can be controlled by a global variable (g:dap_virtual_text
in viml)
-- virtual text deactivated (default)
vim.g.dap_virtual_text = false
-- show virtual text for current frame (recommended)
vim.g.dap_virtual_text = true
-- request variable values for all frames (experimental)
vim.g.dap_virtual_text = 'all frames'
So you could activate the plugin by pasting this into your init.vim
let g:dap_virtual_text = v:true
With vim.g.dap_virtual_text = true
With vim.g.dap_virtual_text = 'all frames'
It works for all languages with locals.scm
in nvim-treesitter (@definition.var
is required for variable definitions).
This should include C/C++, Python, Rust, Go, Java...