Align queries with 'nvim-treesitter'
Some checks failed
ci/woodpecker/push/check Pipeline failed

I fear the upstream queries may be broken, somehow, as they don't work
with `--apply-all-captures` which should match the "last query wins"
matching behaviour of `nvim-treesitter`.

I also removed `locals.scm`, as `tree-sitter` and `nvim-treesitter` don't
agree on how to write it, and I don't really care about it.

It does mean that the highlights can't tell the difference between `int`
the built-in and `int` the type alias anymore, but that's a small
edge-case (and `nvim-treesitter` didn't support it anyway).
This commit is contained in:
Bruno BELANYI 2025-03-13 21:36:13 +00:00
parent ff1535431b
commit e7a123141f
11 changed files with 149 additions and 149 deletions

View file

@ -1,69 +1,104 @@
; Control flow {{{
(if_expression) @indent
"then" @branch
"else" @branch
(if_expression) @indent.begin
(while_expression) @indent
"do" @branch
"then" @indent.branch
"else" @indent.branch
(while_expression) @indent.begin
"do" @indent.branch
(for_expression) @indent.begin
"to" @indent.branch
(for_expression) @indent
"to" @branch
; }}}
; Class {{{
(class_declaration) @indent
(class_declaration "}" @indent_end)
(class_declaration) @indent.begin
(class_declaration
"}" @indent.end)
(class_type) @indent.begin
(class_type
"}" @indent.end)
(class_type) @indent
(class_type "}" @indent_end)
; }}}
; Groups {{{
(let_expression) @indent
"in" @branch
"end" @branch
(let_expression "end" @indent_end)
(let_expression) @indent.begin
"in" @indent.branch
"end" @indent.branch
(let_expression
"end" @indent.end)
(sequence_expression) @indent.begin
")" @indent.branch
(sequence_expression
")" @indent.end)
(sequence_expression) @indent
")" @branch
(sequence_expression ")" @indent_end)
; }}}
; Functions and methods {{{
(parameters) @indent
(parameters ")" @indent_end)
(parameters) @indent.begin
(function_call) @indent
(method_call) @indent
")" @branch
(parameters
")" @indent.end)
(function_call) @indent.begin
(function_call
")" @indent.end)
(method_call) @indent.begin
")" @indent.branch
(function_declaration) @indent.begin
(primitive_declaration) @indent.begin
(method_declaration) @indent.begin
(function_declaration) @indent
(primitive_declaration) @indent
(method_declaration) @indent
; }}}
; Values and expressions {{{
(array_value) @indent
"]" @branch
(array_value "]" @indent_end)
(array_value) @indent.begin
(array_expression) @indent
"of" @branch
"]" @indent.branch
(record_expression) @indent
"}" @branch
(record_expression "}" @indent_end)
(array_value
"]" @indent.end)
(record_type) @indent
"}" @branch
(record_type "}" @indent_end)
(array_expression) @indent.begin
"of" @indent.branch
(record_expression) @indent.begin
"}" @indent.branch
(record_expression
"}" @indent.end)
(record_type) @indent.begin
"}" @indent.branch
(record_type
"}" @indent.end)
(variable_declaration) @indent.begin
(variable_declaration) @indent
; }}}
; Misc{{{
(comment) @ignore
(string_literal) @ignore
; }}}
(comment) @indent.ignore
(string_literal) @indent.ignore
; }}}
; vim: sw=2 foldmethod=marker