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

ext_opts: Disable passive when outside of snippet #180

Closed
jedrzejboczar opened this issue Sep 23, 2021 · 3 comments
Closed

ext_opts: Disable passive when outside of snippet #180

jedrzejboczar opened this issue Sep 23, 2021 · 3 comments

Comments

@jedrzejboczar
Copy link
Contributor

I really like the idea of having an indicators for all the tabstops in a snippet as virtual text with the current one highlighted:
ext_opts_virt_text
with:

ext_opts = {
    [types.choiceNode] = {
        passive = { virt_text = {{'', 'Comment'}}, },
        active = { virt_text = {{'', 'GruvboxOrange'}}, },
    },
    [types.insertNode] = {
        passive = { virt_text = {{'', 'Comment'}}, },
        active = { virt_text = {{'', 'GruvboxBlue'}} },
    }
}

But with history = true the passive indicators persist even after leaving the snippet (and for all the snippets in the history). What would it take to provide something like passive_inside_snippet to apply the virtual text only to the passive nodes in the current snippet?

@L3MON4D3
Copy link
Owner

Ouh, that shouldn't be too hard.
I think extending the keys in the passive, active table by something like snippet_passive could be the best solution as it is the most flexible(if the highlight should stay even while outside the snippet it can be defined as snippet_passive(which would then extend to passive, if it is unspecified)).
What do you think?

@jedrzejboczar
Copy link
Contributor Author

If I understand correctly snippet_passive would do what passive currently does, which would be a breaking change. But I believe most users would rather expect passive to have that "passive only inside a snippet" behaviour, so to me it sounds good :)

@L3MON4D3
Copy link
Owner

Perfect, I'll add it

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