Shows virtual text of the current context at the end of:
- functions
- methods
- if statements
- foreach statements
- classes
If a context expected is not shown you can try to use :lua require 'nvim_context_vt'.showDebug()
to get current and parent node info.
Install treesitter, then use your favourite package manager.
There are no dependencies.
You can use a callback to change the virtual text content.
require('nvim_context_vt').setup {
custom_text_handler = function(node)
return 'my custom virtual text'
end,
}
If you return nil
, no virtual text will be displayed. You can use it to filter out node type which you don't to want virtual text to appear.
require('nvim_context_vt').setup {
custom_text_handler = function(node)
if node:type() == 'function' then
return nil
end
return ts_utils.get_node_text(node)[1]
end,
}