/nvim-dap-virtual-text

Primary LanguageLuaGNU General Public License v3.0GPL-3.0

nvim-dap-virtual-text

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

current_frame

With vim.g.dap_virtual_text = 'all frames'

all_scopes

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...

image

image