mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 11:50:09 -04:00
chore: query formatting
This commit is contained in:
parent
79975d6557
commit
57a8acf0c4
674 changed files with 18466 additions and 12648 deletions
|
|
@ -1,5 +1,5 @@
|
|||
[
|
||||
(compound_statement)
|
||||
(compound_statement)
|
||||
(field_declaration_list)
|
||||
(case_statement)
|
||||
(enumerator_list)
|
||||
|
|
@ -7,56 +7,62 @@
|
|||
(initializer_list)
|
||||
(init_declarator)
|
||||
] @indent.begin
|
||||
|
||||
; With current indent logic, if we capture expression_statement with @indent.begin
|
||||
; It will be affected by _parent_ node with error subnodes deep down the tree
|
||||
; So narrow indent capture to check for error inside expression statement only,
|
||||
; So narrow indent capture to check for error inside expression statement only,
|
||||
(expression_statement
|
||||
(_) @indent.begin
|
||||
";" @indent.end)
|
||||
|
||||
(ERROR
|
||||
"for" "(" @indent.begin ";" ";" ")" @indent.end)
|
||||
"for"
|
||||
"(" @indent.begin
|
||||
";"
|
||||
";"
|
||||
")" @indent.end)
|
||||
|
||||
((for_statement
|
||||
body: (_) @_body) @indent.begin
|
||||
body: (_) @_body) @indent.begin
|
||||
(#not-has-type? @_body compound_statement))
|
||||
|
||||
(while_statement
|
||||
condition: (_) @indent.begin)
|
||||
|
||||
((while_statement
|
||||
body: (_) @_body) @indent.begin
|
||||
body: (_) @_body) @indent.begin
|
||||
(#not-has-type? @_body compound_statement))
|
||||
|
||||
(
|
||||
(if_statement)
|
||||
((if_statement)
|
||||
.
|
||||
(ERROR "else" @indent.begin))
|
||||
(ERROR
|
||||
"else" @indent.begin))
|
||||
|
||||
(if_statement
|
||||
condition: (_) @indent.begin)
|
||||
|
||||
;; Supports if without braces (but not both if-else without braces)
|
||||
; Supports if without braces (but not both if-else without braces)
|
||||
((if_statement
|
||||
consequence:
|
||||
(_ ";" @indent.end) @_consequence
|
||||
(#not-has-type? @_consequence compound_statement)
|
||||
consequence:
|
||||
(_
|
||||
";" @indent.end) @_consequence
|
||||
(#not-has-type? @_consequence compound_statement)
|
||||
alternative:
|
||||
(else_clause
|
||||
(else_clause
|
||||
"else" @indent.branch
|
||||
[
|
||||
(if_statement (compound_statement) @indent.dedent)? @indent.dedent
|
||||
[
|
||||
(if_statement
|
||||
(compound_statement) @indent.dedent)? @indent.dedent
|
||||
(compound_statement)? @indent.dedent
|
||||
(_)? @indent.dedent
|
||||
]
|
||||
)?
|
||||
) @indent.begin)
|
||||
])?) @indent.begin)
|
||||
|
||||
(else_clause (_ . "{" @indent.branch))
|
||||
(else_clause
|
||||
(_
|
||||
.
|
||||
"{" @indent.branch))
|
||||
|
||||
|
||||
(compound_statement "}" @indent.end)
|
||||
(compound_statement
|
||||
"}" @indent.end)
|
||||
|
||||
[
|
||||
")"
|
||||
|
|
@ -79,12 +85,16 @@
|
|||
(string_literal)
|
||||
] @indent.ignore
|
||||
|
||||
((ERROR (parameter_declaration)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
([(argument_list) (parameter_list)] @indent.align
|
||||
((ERROR
|
||||
(parameter_declaration)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
([
|
||||
(argument_list)
|
||||
(parameter_list)
|
||||
] @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
(comment) @indent.auto
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue