Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
willhansen opened this issue May 16, 2024 · 2 comments
Open

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

willhansen opened this issue May 16, 2024 · 2 comments

Comments

@willhansen
Copy link

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>
@andersevenrud
Copy link
Owner

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.

@willhansen
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants