Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.

Conversation

@jchros
Copy link
Contributor

@jchros jchros commented Oct 19, 2022

Side note, I wanted to add a highlight test for :call statements, but I encountered a quirk in tree-sitter's handling of queries: in the tree-sitter syntax highlighting test script, the earliest matching capture has higher precedence, whereas in Neovim, the latest capture has a higher precedence. I don't know if it's a bug or if it's intended but either way, this will prevent us from exhaustively testing our syntax highlighting query file while enforcing the same behavior in nvim-treesitter as in tree-sitter.

@jchros jchros changed the title Add support for ranges in :call statements Add support for ranges in :call and :global Oct 19, 2022
Copy link
Owner

@vigoux vigoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't worry about the problem you mentionned. This little quirk around the difference of behavior between tree-sitter highlighting and neovim highlighting is fine.

We might want to build our own tool to check for neovim highlighting though...

@vigoux
Copy link
Owner

vigoux commented Oct 20, 2022

Could you rebase on latest master and update the files ?

@jchros
Copy link
Contributor Author

jchros commented Oct 20, 2022

Done.

@jchros
Copy link
Contributor Author

jchros commented Oct 20, 2022

Don't worry about the problem you mentionned. This little quirk around the difference of behavior between tree-sitter highlighting and neovim highlighting is fine.

We might want to build our own tool to check for neovim highlighting though...

Another approach would be to restructure the highlighting queries to make the higher priority highlight patterns appear first (so that it works in the tree-sitter test), but then set the priority of these matches to 101 (so that it works in Neovim). I think it'll work because tree-sitter doesn't understand the (#set! "priority" 101) predicate. I'll experiment with this on another branch and I'll make a PR if that works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants