mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-14 09:20:04 -04:00
chore: query formatting
This commit is contained in:
parent
79975d6557
commit
57a8acf0c4
674 changed files with 18466 additions and 12648 deletions
|
|
@ -3,18 +3,14 @@
|
|||
(function_declaration)
|
||||
(member_declaration)
|
||||
(enum_declaration)
|
||||
|
||||
(array)
|
||||
(block)
|
||||
(table)
|
||||
(anonymous_function)
|
||||
(parenthesized_expression)
|
||||
|
||||
(string)
|
||||
(verbatim_string)
|
||||
|
||||
(comment)
|
||||
|
||||
(if_statement)
|
||||
(else_statement)
|
||||
(while_statement)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
; Keywords
|
||||
|
||||
[
|
||||
"class"
|
||||
"clone"
|
||||
|
|
@ -11,9 +10,7 @@
|
|||
"var"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"function"
|
||||
] @keyword.function
|
||||
"function" @keyword.function
|
||||
|
||||
[
|
||||
"in"
|
||||
|
|
@ -27,12 +24,11 @@
|
|||
] @keyword.return
|
||||
|
||||
((global_variable
|
||||
"::"
|
||||
(_) @keyword.coroutine)
|
||||
"::"
|
||||
(_) @keyword.coroutine)
|
||||
(#any-of? @keyword.coroutine "suspend" "newthread"))
|
||||
|
||||
; Conditionals
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
|
|
@ -43,7 +39,6 @@
|
|||
] @keyword.conditional
|
||||
|
||||
; Repeats
|
||||
|
||||
[
|
||||
"for"
|
||||
"foreach"
|
||||
|
|
@ -53,7 +48,6 @@
|
|||
] @keyword.repeat
|
||||
|
||||
; Exceptions
|
||||
|
||||
[
|
||||
"try"
|
||||
"catch"
|
||||
|
|
@ -61,26 +55,21 @@
|
|||
] @keyword.exception
|
||||
|
||||
; Storageclasses
|
||||
|
||||
[
|
||||
"local"
|
||||
] @keyword.storage
|
||||
"local" @keyword.storage
|
||||
|
||||
; Qualifiers
|
||||
|
||||
[
|
||||
"static"
|
||||
"const"
|
||||
] @type.qualifier
|
||||
|
||||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
(identifier) @variable
|
||||
|
||||
(local_declaration
|
||||
(identifier) @variable.local
|
||||
. "=")
|
||||
|
||||
.
|
||||
"=")
|
||||
|
||||
(global_variable) @variable.global
|
||||
|
||||
|
|
@ -88,58 +77,76 @@
|
|||
(#any-of? @variable.builtin "base" "this" "vargv"))
|
||||
|
||||
; Parameters
|
||||
|
||||
(parameter
|
||||
. (identifier) @variable.parameter)
|
||||
.
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
; Properties (Slots)
|
||||
|
||||
(deref_expression
|
||||
"."
|
||||
. (identifier) @property)
|
||||
.
|
||||
(identifier) @property)
|
||||
|
||||
(member_declaration
|
||||
(identifier) @property
|
||||
. "=")
|
||||
.
|
||||
"=")
|
||||
|
||||
((table_slot
|
||||
. (identifier) @property
|
||||
. ["=" ":"])
|
||||
.
|
||||
(identifier) @property
|
||||
.
|
||||
[
|
||||
"="
|
||||
":"
|
||||
])
|
||||
(#set! "priority" 105))
|
||||
|
||||
; Types
|
||||
|
||||
((identifier) @type
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
(class_declaration
|
||||
(identifier) @type
|
||||
"extends"? . (identifier)? @type)
|
||||
"extends"?
|
||||
.
|
||||
(identifier)? @type)
|
||||
|
||||
(enum_declaration
|
||||
(identifier) @type)
|
||||
|
||||
; Attributes
|
||||
|
||||
(attribute_declaration
|
||||
left: (identifier) @attribute)
|
||||
|
||||
; Functions & Methods
|
||||
|
||||
(member_declaration
|
||||
(function_declaration
|
||||
"::"? (_) @function.method . "(" (_)? ")"))
|
||||
"::"?
|
||||
(_) @function.method
|
||||
.
|
||||
"("
|
||||
(_)?
|
||||
")"))
|
||||
|
||||
((function_declaration
|
||||
"::"? (_) @function . "(" (_)? ")")
|
||||
"::"?
|
||||
(_) @function
|
||||
.
|
||||
"("
|
||||
(_)?
|
||||
")")
|
||||
(#not-has-ancestor? @function member_declaration))
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.call)
|
||||
|
||||
(call_expression
|
||||
function: (deref_expression
|
||||
"." . (identifier) @function.call))
|
||||
function:
|
||||
(deref_expression
|
||||
"."
|
||||
.
|
||||
(identifier) @function.call))
|
||||
|
||||
(call_expression
|
||||
(global_variable
|
||||
|
|
@ -152,11 +159,17 @@
|
|||
(lambda_expression
|
||||
"@" @string.special.symbol))
|
||||
|
||||
(call_expression
|
||||
(call_expression
|
||||
[
|
||||
function: (identifier) @function.builtin
|
||||
function: (global_variable "::" (_) @function.builtin)
|
||||
function: (deref_expression "." (_) @function.builtin)
|
||||
function: (identifier) @function.builtin
|
||||
function:
|
||||
(global_variable
|
||||
"::"
|
||||
(_) @function.builtin)
|
||||
function:
|
||||
(deref_expression
|
||||
"."
|
||||
(_) @function.builtin)
|
||||
]
|
||||
; format-ignore
|
||||
(#any-of? @function.builtin
|
||||
|
|
@ -206,20 +219,20 @@
|
|||
"constructor" @constructor)
|
||||
|
||||
; Constants
|
||||
|
||||
(const_declaration
|
||||
"const"
|
||||
. (identifier) @constant)
|
||||
.
|
||||
(identifier) @constant)
|
||||
|
||||
(enum_declaration
|
||||
"{"
|
||||
. (identifier) @constant)
|
||||
.
|
||||
(identifier) @constant)
|
||||
|
||||
((identifier) @constant
|
||||
(#lua-match? @constant "^_*[A-Z][A-Z%d_]*$"))
|
||||
(#lua-match? @constant "^_*[A-Z][A-Z%d_]*$"))
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
|
|
@ -255,14 +268,25 @@
|
|||
] @operator
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[ "{" "}" ] @punctuation.bracket
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[ "[" "]" ] @punctuation.bracket
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
[ "(" ")" ] @punctuation.bracket
|
||||
|
||||
[ "</" "/>" ] @punctuation.bracket
|
||||
[
|
||||
"</"
|
||||
"/>"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"."
|
||||
|
|
@ -277,13 +301,11 @@
|
|||
] @punctuation.special
|
||||
|
||||
; Ternaries
|
||||
|
||||
(ternary_expression
|
||||
"?" @keyword.conditional.ternary
|
||||
":" @keyword.conditional.ternary)
|
||||
|
||||
; Literals
|
||||
|
||||
(string) @string
|
||||
|
||||
(verbatim_string) @string.special
|
||||
|
|
@ -301,7 +323,6 @@
|
|||
(null) @constant.builtin
|
||||
|
||||
; Comments
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
((comment) @comment.documentation
|
||||
|
|
|
|||
|
|
@ -2,13 +2,11 @@
|
|||
(class_declaration)
|
||||
(function_declaration)
|
||||
(enum_declaration)
|
||||
|
||||
(array)
|
||||
(block)
|
||||
(table)
|
||||
(anonymous_function)
|
||||
(parenthesized_expression)
|
||||
|
||||
(while_statement)
|
||||
(switch_statement)
|
||||
(for_statement)
|
||||
|
|
@ -17,10 +15,9 @@
|
|||
(catch_statement)
|
||||
] @indent.begin
|
||||
|
||||
(
|
||||
(if_statement)
|
||||
(ERROR "else") @indent.begin
|
||||
)
|
||||
((if_statement)
|
||||
(ERROR
|
||||
"else") @indent.begin)
|
||||
|
||||
(if_statement
|
||||
condition: (_) @indent.begin)
|
||||
|
|
@ -37,11 +34,20 @@
|
|||
(_) @indent.begin
|
||||
(catch_statement) @indent.begin)
|
||||
|
||||
[ "{" "}" ] @indent.branch
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @indent.branch
|
||||
|
||||
[ "(" ")" ] @indent.branch
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @indent.branch
|
||||
|
||||
[ "[" "]" ] @indent.branch
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
"}"
|
||||
|
|
@ -52,7 +58,6 @@
|
|||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
|
||||
(string)
|
||||
(verbatim_string)
|
||||
] @indent.auto
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((verbatim_string) @injection.content
|
||||
(#lua-match? @injection.content "^@\"<html")
|
||||
|
|
|
|||
|
|
@ -1,18 +1,15 @@
|
|||
; Scopes
|
||||
|
||||
[
|
||||
(script)
|
||||
(class_declaration)
|
||||
(enum_declaration)
|
||||
(function_declaration)
|
||||
(attribute_declaration)
|
||||
|
||||
(array)
|
||||
(block)
|
||||
(table)
|
||||
(anonymous_function)
|
||||
(parenthesized_expression)
|
||||
|
||||
(if_statement)
|
||||
(else_statement)
|
||||
(while_statement)
|
||||
|
|
@ -24,44 +21,55 @@
|
|||
(catch_statement)
|
||||
] @local.scope
|
||||
|
||||
|
||||
; References
|
||||
|
||||
[
|
||||
(identifier)
|
||||
(global_variable)
|
||||
] @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(const_declaration
|
||||
. (identifier) @local.definition.constant)
|
||||
.
|
||||
(identifier) @local.definition.constant)
|
||||
|
||||
(enum_declaration
|
||||
. (identifier) @local.definition.enum)
|
||||
.
|
||||
(identifier) @local.definition.enum)
|
||||
|
||||
(member_declaration
|
||||
(identifier) @local.definition.field
|
||||
. "=")
|
||||
(identifier) @local.definition.field
|
||||
.
|
||||
"=")
|
||||
|
||||
(table_slot
|
||||
. (identifier) @local.definition.field
|
||||
. ["=" ":"])
|
||||
.
|
||||
(identifier) @local.definition.field
|
||||
.
|
||||
[
|
||||
"="
|
||||
":"
|
||||
])
|
||||
|
||||
((function_declaration
|
||||
. (identifier) @local.definition.function)
|
||||
.
|
||||
(identifier) @local.definition.function)
|
||||
(#not-has-ancestor? @local.definition.function member_declaration))
|
||||
|
||||
(member_declaration
|
||||
(function_declaration
|
||||
. (identifier) @local.definition.method))
|
||||
.
|
||||
(identifier) @local.definition.method))
|
||||
|
||||
(class_declaration
|
||||
. (identifier) @local.definition.type)
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(var_statement
|
||||
"var" . (identifier) @local.definition.variable)
|
||||
"var"
|
||||
.
|
||||
(identifier) @local.definition.variable)
|
||||
|
||||
(local_declaration
|
||||
(identifier) @local.definition.variable
|
||||
. "=")
|
||||
(identifier) @local.definition.variable
|
||||
.
|
||||
"=")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue