mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-17 10:50:06 -04:00
chore: query formatting
This commit is contained in:
parent
79975d6557
commit
57a8acf0c4
674 changed files with 18466 additions and 12648 deletions
|
|
@ -8,12 +8,9 @@
|
|||
(let_expression)
|
||||
(function_declaration)
|
||||
(primitive_declaration)
|
||||
|
||||
(record_type)
|
||||
|
||||
(class_declaration)
|
||||
(class_type)
|
||||
(method_declaration)
|
||||
] @fold
|
||||
|
||||
; vim: sw=2 foldmethod=marker
|
||||
|
|
|
|||
|
|
@ -1,29 +1,20 @@
|
|||
; Built-ins {{{
|
||||
((function_call
|
||||
function: (identifier) @function.builtin)
|
||||
(#any-of? @function.builtin "chr" "concat" "exit" "flush" "getchar" "not" "ord" "print" "print_err" "print_int" "size" "strcmp" "streq" "substring")
|
||||
; FIXME: not supported by neovim
|
||||
; (#is-not? local)
|
||||
)
|
||||
(#any-of? @function.builtin "chr" "concat" "exit" "flush" "getchar" "not" "ord" "print" "print_err" "print_int" "size" "strcmp" "streq" "substring"))
|
||||
|
||||
((type_identifier) @type.builtin
|
||||
(#any-of? @type.builtin "int" "string" "Object")
|
||||
; FIXME: not supported by neovim
|
||||
; (#is-not? local)
|
||||
)
|
||||
(#any-of? @type.builtin "int" "string" "Object"))
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "self")
|
||||
; FIXME: not supported by neovim
|
||||
; (#is-not? local)
|
||||
)
|
||||
; }}}
|
||||
(#eq? @variable.builtin "self"))
|
||||
|
||||
; }}}
|
||||
; Keywords {{{
|
||||
[
|
||||
"function"
|
||||
"primitive"
|
||||
"method"
|
||||
"function"
|
||||
"primitive"
|
||||
"method"
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
|
|
@ -49,73 +40,79 @@
|
|||
"then"
|
||||
"type"
|
||||
"var"
|
||||
|
||||
"class"
|
||||
"extends"
|
||||
|
||||
"_cast"
|
||||
"_chunks"
|
||||
"_exp"
|
||||
"_lvalue"
|
||||
"_namety"
|
||||
] @keyword
|
||||
; }}}
|
||||
|
||||
; }}}
|
||||
; Operators {{{
|
||||
(operator) @operator
|
||||
|
||||
[
|
||||
","
|
||||
";"
|
||||
":"
|
||||
"."
|
||||
","
|
||||
";"
|
||||
":"
|
||||
"."
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
; }}}
|
||||
|
||||
; }}}
|
||||
; Functions and methods {{{
|
||||
(function_call
|
||||
function: (identifier) @function)
|
||||
|
||||
(function_declaration
|
||||
name: (identifier) @function)
|
||||
|
||||
(primitive_declaration
|
||||
name: (identifier) @function)
|
||||
|
||||
(method_call
|
||||
method: (identifier) @function.method)
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @function.method)
|
||||
|
||||
(parameters
|
||||
name: (identifier) @variable.parameter)
|
||||
; }}}
|
||||
|
||||
; }}}
|
||||
; Declarations {{{
|
||||
(import_declaration
|
||||
file: (string_literal) @string.special.path)
|
||||
; }}}
|
||||
|
||||
; }}}
|
||||
; Literals {{{
|
||||
(nil_literal) @constant.builtin
|
||||
(integer_literal) @number
|
||||
(string_literal) @string
|
||||
(escape_sequence) @string.escape
|
||||
; }}}
|
||||
|
||||
(integer_literal) @number
|
||||
|
||||
(string_literal) @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
; }}}
|
||||
; Misc {{{
|
||||
(comment) @comment @spell
|
||||
|
||||
(type_identifier) @type
|
||||
(field_identifier) @property
|
||||
(identifier) @variable
|
||||
; }}}
|
||||
|
||||
(field_identifier) @property
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; }}}
|
||||
; vim: sw=2 foldmethod=marker
|
||||
|
|
|
|||
|
|
@ -1,70 +1,104 @@
|
|||
; Control flow {{{
|
||||
(if_expression) @indent.begin
|
||||
|
||||
"then" @indent.branch
|
||||
|
||||
"else" @indent.branch
|
||||
|
||||
(while_expression) @indent.begin
|
||||
|
||||
"do" @indent.branch
|
||||
|
||||
(for_expression) @indent.begin
|
||||
"to" @indent.branch
|
||||
; }}}
|
||||
|
||||
"to" @indent.branch
|
||||
|
||||
; }}}
|
||||
; Class {{{
|
||||
(class_declaration) @indent.begin
|
||||
(class_declaration "}" @indent.end)
|
||||
|
||||
(class_declaration
|
||||
"}" @indent.end)
|
||||
|
||||
(class_type) @indent.begin
|
||||
(class_type "}" @indent.end)
|
||||
; }}}
|
||||
|
||||
(class_type
|
||||
"}" @indent.end)
|
||||
|
||||
; }}}
|
||||
; Groups {{{
|
||||
(let_expression) @indent.begin
|
||||
|
||||
"in" @indent.branch
|
||||
|
||||
"end" @indent.branch
|
||||
(let_expression "end" @indent.end)
|
||||
|
||||
(let_expression
|
||||
"end" @indent.end)
|
||||
|
||||
(sequence_expression) @indent.begin
|
||||
")" @indent.branch
|
||||
(sequence_expression ")" @indent.end)
|
||||
; }}}
|
||||
|
||||
")" @indent.branch
|
||||
|
||||
(sequence_expression
|
||||
")" @indent.end)
|
||||
|
||||
; }}}
|
||||
; Functions and methods {{{
|
||||
(parameters) @indent.begin
|
||||
(parameters ")" @indent.end)
|
||||
|
||||
(parameters
|
||||
")" @indent.end)
|
||||
|
||||
(function_call) @indent.begin
|
||||
(function_call ")" @indent.end)
|
||||
|
||||
(function_call
|
||||
")" @indent.end)
|
||||
|
||||
(method_call) @indent.begin
|
||||
|
||||
")" @indent.branch
|
||||
|
||||
(function_declaration) @indent.begin
|
||||
(primitive_declaration) @indent.begin
|
||||
(method_declaration) @indent.begin
|
||||
; }}}
|
||||
|
||||
(primitive_declaration) @indent.begin
|
||||
|
||||
(method_declaration) @indent.begin
|
||||
|
||||
; }}}
|
||||
; Values and expressions {{{
|
||||
(array_value) @indent.begin
|
||||
|
||||
"]" @indent.branch
|
||||
(array_value "]" @indent.end)
|
||||
|
||||
(array_value
|
||||
"]" @indent.end)
|
||||
|
||||
(array_expression) @indent.begin
|
||||
|
||||
"of" @indent.branch
|
||||
|
||||
(record_expression) @indent.begin
|
||||
|
||||
"}" @indent.branch
|
||||
(record_expression "}" @indent.end)
|
||||
|
||||
(record_expression
|
||||
"}" @indent.end)
|
||||
|
||||
(record_type) @indent.begin
|
||||
|
||||
"}" @indent.branch
|
||||
(record_type "}" @indent.end)
|
||||
|
||||
(record_type
|
||||
"}" @indent.end)
|
||||
|
||||
(variable_declaration) @indent.begin
|
||||
; }}}
|
||||
|
||||
; }}}
|
||||
; Misc{{{
|
||||
(comment) @indent.ignore
|
||||
(string_literal) @indent.ignore
|
||||
; }}}
|
||||
|
||||
(string_literal) @indent.ignore
|
||||
|
||||
; }}}
|
||||
; vim: sw=2 foldmethod=marker
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
(#set! injection.language "comment"))
|
||||
; vim: sw=2 foldmethod=marker
|
||||
|
|
|
|||
|
|
@ -3,15 +3,14 @@
|
|||
; top-to-bottom).
|
||||
;
|
||||
; [1]: https://github.com/tree-sitter/tree-sitter/issues/918
|
||||
|
||||
; Scopes {{{
|
||||
[
|
||||
(for_expression)
|
||||
(let_expression)
|
||||
(function_declaration)
|
||||
(for_expression)
|
||||
(let_expression)
|
||||
(function_declaration)
|
||||
] @local.scope
|
||||
; }}}
|
||||
|
||||
; }}}
|
||||
; Definitions {{{
|
||||
(type_declaration
|
||||
name: (identifier) @local.definition.type
|
||||
|
|
@ -23,6 +22,7 @@
|
|||
(function_declaration
|
||||
name: (identifier) @local.definition.function
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
|
||||
(primitive_declaration
|
||||
name: (identifier) @local.definition.function
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
|
|
@ -30,10 +30,10 @@
|
|||
(variable_declaration
|
||||
name: (identifier) @local.definition.var
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
; }}}
|
||||
|
||||
; }}}
|
||||
; References {{{
|
||||
(identifier) @local.reference
|
||||
; }}}
|
||||
|
||||
; }}}
|
||||
; vim: sw=2 foldmethod=marker
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue