mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-15 18:00:07 -04:00
chore: query formatting
This commit is contained in:
parent
79975d6557
commit
57a8acf0c4
674 changed files with 18466 additions and 12648 deletions
|
|
@ -1,11 +1,13 @@
|
|||
[(if_statement)
|
||||
(for_statement)
|
||||
(while_statement)
|
||||
(switch_statement)
|
||||
(try_statement)
|
||||
(function_definition)
|
||||
(class_definition)
|
||||
(enumeration)
|
||||
(events)
|
||||
(methods)
|
||||
(properties)] @fold
|
||||
[
|
||||
(if_statement)
|
||||
(for_statement)
|
||||
(while_statement)
|
||||
(switch_statement)
|
||||
(try_statement)
|
||||
(function_definition)
|
||||
(class_definition)
|
||||
(enumeration)
|
||||
(events)
|
||||
(methods)
|
||||
(properties)
|
||||
] @fold
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
; Includes
|
||||
|
||||
((command_name) @keyword.import
|
||||
(#eq? @keyword.import "import"))
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"arguments"
|
||||
"classdef"
|
||||
|
|
@ -18,91 +16,149 @@
|
|||
] @keyword
|
||||
|
||||
; Conditionals
|
||||
(if_statement
|
||||
[
|
||||
"if"
|
||||
"end"
|
||||
] @keyword.conditional)
|
||||
|
||||
(elseif_clause
|
||||
"elseif" @keyword.conditional)
|
||||
|
||||
(else_clause
|
||||
"else" @keyword.conditional)
|
||||
|
||||
(switch_statement
|
||||
[
|
||||
"switch"
|
||||
"end"
|
||||
] @keyword.conditional)
|
||||
|
||||
(case_clause
|
||||
"case" @keyword.conditional)
|
||||
|
||||
(otherwise_clause
|
||||
"otherwise" @keyword.conditional)
|
||||
|
||||
(if_statement [ "if" "end" ] @keyword.conditional)
|
||||
(elseif_clause "elseif" @keyword.conditional)
|
||||
(else_clause "else" @keyword.conditional)
|
||||
(switch_statement [ "switch" "end" ] @keyword.conditional)
|
||||
(case_clause "case" @keyword.conditional)
|
||||
(otherwise_clause "otherwise" @keyword.conditional)
|
||||
(break_statement) @keyword.conditional
|
||||
|
||||
; Repeats
|
||||
(for_statement
|
||||
[
|
||||
"for"
|
||||
"parfor"
|
||||
"end"
|
||||
] @keyword.repeat)
|
||||
|
||||
(while_statement
|
||||
[
|
||||
"while"
|
||||
"end"
|
||||
] @keyword.repeat)
|
||||
|
||||
(for_statement [ "for" "parfor" "end" ] @keyword.repeat)
|
||||
(while_statement [ "while" "end" ] @keyword.repeat)
|
||||
(continue_statement) @keyword.repeat
|
||||
|
||||
; Exceptions
|
||||
(try_statement
|
||||
[
|
||||
"try"
|
||||
"end"
|
||||
] @keyword.exception)
|
||||
|
||||
(try_statement [ "try" "end" ] @keyword.exception)
|
||||
(catch_clause "catch" @keyword.exception)
|
||||
(catch_clause
|
||||
"catch" @keyword.exception)
|
||||
|
||||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; Constants
|
||||
(events
|
||||
(identifier) @constant)
|
||||
|
||||
(events (identifier) @constant)
|
||||
(attribute (identifier) @constant)
|
||||
(attribute
|
||||
(identifier) @constant)
|
||||
|
||||
"~" @constant.builtin
|
||||
|
||||
; Fields/Properties
|
||||
(field_expression
|
||||
field: (identifier) @variable.member)
|
||||
|
||||
(field_expression field: (identifier) @variable.member)
|
||||
(superclass
|
||||
"."
|
||||
(identifier) @property)
|
||||
|
||||
(superclass "." (identifier) @property)
|
||||
(property_name
|
||||
"."
|
||||
(identifier) @property)
|
||||
|
||||
(property_name "." (identifier) @property)
|
||||
|
||||
(property name: (identifier) @property)
|
||||
(property
|
||||
name: (identifier) @property)
|
||||
|
||||
; Types
|
||||
(class_definition
|
||||
name: (identifier) @type)
|
||||
|
||||
(class_definition name: (identifier) @type)
|
||||
(attributes
|
||||
(identifier) @constant)
|
||||
|
||||
(attributes (identifier) @constant)
|
||||
|
||||
(enum . (identifier) @type)
|
||||
(enum
|
||||
.
|
||||
(identifier) @type)
|
||||
|
||||
((identifier) @type
|
||||
(#lua-match? @type "^_*[A-Z][a-zA-Z0-9_]+$"))
|
||||
|
||||
; Functions
|
||||
|
||||
(function_definition
|
||||
"function" @keyword.function
|
||||
name: (identifier) @function
|
||||
[ "end" "endfunction" ]? @keyword.function)
|
||||
[
|
||||
"end"
|
||||
"endfunction"
|
||||
]?
|
||||
@keyword.function)
|
||||
|
||||
(function_signature name: (identifier) @function)
|
||||
(function_signature
|
||||
name: (identifier) @function)
|
||||
|
||||
(function_call
|
||||
name: (identifier) @function.call)
|
||||
|
||||
(handle_operator (identifier) @function)
|
||||
(handle_operator
|
||||
(identifier) @function)
|
||||
|
||||
(validation_functions (identifier) @function)
|
||||
(validation_functions
|
||||
(identifier) @function)
|
||||
|
||||
(command
|
||||
(command_name) @function.call)
|
||||
|
||||
(command (command_name) @function.call)
|
||||
(command_argument) @variable.parameter
|
||||
|
||||
(return_statement) @keyword.return
|
||||
|
||||
; Parameters
|
||||
|
||||
(function_arguments (identifier) @variable.parameter)
|
||||
(function_arguments
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
";"
|
||||
","
|
||||
"."
|
||||
] @punctuation.delimiter
|
||||
|
||||
[ ";" "," "." ] @punctuation.delimiter
|
||||
|
||||
[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"+"
|
||||
".+"
|
||||
|
|
@ -135,10 +191,10 @@
|
|||
] @operator
|
||||
|
||||
; Literals
|
||||
|
||||
(string) @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(formatting_sequence) @string.special
|
||||
|
||||
(number) @number
|
||||
|
|
@ -146,5 +202,7 @@
|
|||
(boolean) @boolean
|
||||
|
||||
; Comments
|
||||
|
||||
[ (comment) (line_continuation) ] @comment @spell
|
||||
[
|
||||
(comment)
|
||||
(line_continuation)
|
||||
] @comment @spell
|
||||
|
|
|
|||
|
|
@ -22,14 +22,18 @@
|
|||
"catch"
|
||||
] @indent.branch
|
||||
|
||||
((matrix (row) @indent.align)
|
||||
(#set! indent.open_delimiter "[")
|
||||
(#set! indent.close_delimiter "]"))
|
||||
((cell (row) @indent.align)
|
||||
(#set! indent.open_delimiter "{")
|
||||
(#set! indent.close_delimiter "}"))
|
||||
((matrix
|
||||
(row) @indent.align)
|
||||
(#set! indent.open_delimiter "[")
|
||||
(#set! indent.close_delimiter "]"))
|
||||
|
||||
((cell
|
||||
(row) @indent.align)
|
||||
(#set! indent.open_delimiter "{")
|
||||
(#set! indent.close_delimiter "}"))
|
||||
|
||||
((parenthesis) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
(comment) @indent.auto
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
(#set! injection.language "comment"))
|
||||
|
|
|
|||
|
|
@ -1,20 +1,33 @@
|
|||
; References
|
||||
|
||||
(identifier) @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @local.definition.function
|
||||
(function_arguments
|
||||
(identifier)* @local.definition.parameter
|
||||
("," (identifier) @local.definition.parameter)*)?) @local.scope
|
||||
(","
|
||||
(identifier) @local.definition.parameter)*)?) @local.scope
|
||||
|
||||
(assignment left: (identifier) @local.definition.var)
|
||||
(multioutput_variable (identifier) @local.definition.var)
|
||||
(assignment
|
||||
left: (identifier) @local.definition.var)
|
||||
|
||||
(iterator . (identifier) @local.definition.var)
|
||||
(lambda (arguments (identifier) @local.definition.parameter))
|
||||
(global_operator (identifier) @local.definition.var)
|
||||
(persistent_operator (identifier) @local.definition.var)
|
||||
(catch_clause (identifier) @local.definition)
|
||||
(multioutput_variable
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(iterator
|
||||
.
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(lambda
|
||||
(arguments
|
||||
(identifier) @local.definition.parameter))
|
||||
|
||||
(global_operator
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(persistent_operator
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(catch_clause
|
||||
(identifier) @local.definition)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue