andersevenrud / nvim_context_vt

Virtual text context for neovim treesitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possible to show virtual text no matter where the cursor is?

willhansen opened this issue · comments

As can be seen in the gif in the readme, the virtual text is only visible if the cursor is inside a scope block.

Is there an option to show it no matter where the cursor is?

Current behavior:

A {
<CURSOR IS HERE>
} --> A {

🡇

A {

} 
<CURSOR IS HERE>

Desired behavior:

A {
<CURSOR IS HERE>
} --> A {

🡇

A {

} --> A {
<CURSOR IS HERE>

Hi!

Is there an option to show it no matter where the cursor is?

Not currently, but possible.

This plugin traverses downwards in the tree to show the current context in the block.

If I understand you correctly then this behaviour would have to be changed so that it traverses upward from the root node and not the cursor node.

I'm not too familiar with treesitter, but my first guess would be to replace the_line_the_cursor_is_on with a for loop of every_line_visible_in_the_window (probably some optimization possible there), and triggering the update on window motion rather than cursor motion.