tree-sitter-viml icon indicating copy to clipboard operation
tree-sitter-viml copied to clipboard

Add support for ranges in `:call` and `:global`

Open jchros opened this issue 3 years ago • 3 comments

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 avatar Oct 19 '22 00:10 jchros

Could you rebase on latest master and update the files ?

vigoux avatar Oct 20 '22 12:10 vigoux

Done.

jchros avatar Oct 20 '22 16:10 jchros

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.

jchros avatar Oct 20 '22 16:10 jchros