mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-17 19:00:02 -04:00
chore: query formatting
This commit is contained in:
parent
79975d6557
commit
57a8acf0c4
674 changed files with 18466 additions and 12648 deletions
|
|
@ -1,20 +1,16 @@
|
|||
[
|
||||
(use_statement)
|
||||
(use_statement)
|
||||
(actor_definition)
|
||||
(class_definition)
|
||||
(primitive_definition)
|
||||
(interface_definition)
|
||||
(trait_definition)
|
||||
(struct_definition)
|
||||
|
||||
(constructor)
|
||||
(method)
|
||||
(behavior)
|
||||
|
||||
(parameters)
|
||||
|
||||
(type)
|
||||
|
||||
(if_statement)
|
||||
(iftype_statement)
|
||||
(elseif_block)
|
||||
|
|
@ -30,10 +26,8 @@
|
|||
(case_statement)
|
||||
(parenthesized_expression)
|
||||
(tuple_expression)
|
||||
|
||||
(array_literal)
|
||||
(object_literal)
|
||||
(string)
|
||||
|
||||
(block_comment)
|
||||
] @fold
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
; Includes
|
||||
|
||||
[
|
||||
"use"
|
||||
] @keyword.import
|
||||
"use" @keyword.import
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"type"
|
||||
"actor"
|
||||
|
|
@ -25,25 +21,18 @@
|
|||
"where"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"fun"
|
||||
] @keyword.function
|
||||
"fun" @keyword.function
|
||||
|
||||
[
|
||||
"be"
|
||||
] @keyword.coroutine
|
||||
"be" @keyword.coroutine
|
||||
|
||||
[
|
||||
"in"
|
||||
"is"
|
||||
] @keyword.operator
|
||||
|
||||
[
|
||||
"return"
|
||||
] @keyword.return
|
||||
"return" @keyword.return
|
||||
|
||||
; Qualifiers
|
||||
|
||||
[
|
||||
"iso"
|
||||
"trn"
|
||||
|
|
@ -59,7 +48,6 @@
|
|||
] @type.qualifier
|
||||
|
||||
; Conditionals
|
||||
|
||||
[
|
||||
"if"
|
||||
"ifdef"
|
||||
|
|
@ -70,14 +58,16 @@
|
|||
"match"
|
||||
] @keyword.conditional
|
||||
|
||||
(if_statement "end" @keyword.conditional)
|
||||
(if_statement
|
||||
"end" @keyword.conditional)
|
||||
|
||||
(iftype_statement "end" @keyword.conditional)
|
||||
(iftype_statement
|
||||
"end" @keyword.conditional)
|
||||
|
||||
(match_statement "end" @keyword.conditional)
|
||||
(match_statement
|
||||
"end" @keyword.conditional)
|
||||
|
||||
; Repeats
|
||||
|
||||
[
|
||||
"repeat"
|
||||
"until"
|
||||
|
|
@ -88,86 +78,112 @@
|
|||
"break"
|
||||
] @keyword.repeat
|
||||
|
||||
(do_block "end" @keyword.repeat)
|
||||
(do_block
|
||||
"end" @keyword.repeat)
|
||||
|
||||
(repeat_statement "end" @keyword.repeat)
|
||||
(repeat_statement
|
||||
"end" @keyword.repeat)
|
||||
|
||||
; Exceptions
|
||||
|
||||
[
|
||||
"try"
|
||||
(error)
|
||||
"compile_error"
|
||||
] @keyword.exception
|
||||
|
||||
(try_statement "end" @keyword.exception)
|
||||
(try_statement
|
||||
"end" @keyword.exception)
|
||||
|
||||
(recover_statement "end" @keyword.exception)
|
||||
(recover_statement
|
||||
"end" @keyword.exception)
|
||||
|
||||
; Attributes
|
||||
|
||||
(annotation) @attribute
|
||||
|
||||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(this) @variable.builtin
|
||||
|
||||
; Fields
|
||||
(field
|
||||
name: (identifier) @variable.member)
|
||||
|
||||
(field name: (identifier) @variable.member)
|
||||
|
||||
(member_expression "." (identifier) @variable.member)
|
||||
(member_expression
|
||||
"."
|
||||
(identifier) @variable.member)
|
||||
|
||||
; Constructors
|
||||
|
||||
(constructor "new" @keyword.operator (identifier) @constructor)
|
||||
(constructor
|
||||
"new" @keyword.operator
|
||||
(identifier) @constructor)
|
||||
|
||||
; Methods
|
||||
(method
|
||||
(identifier) @function.method)
|
||||
|
||||
(method (identifier) @function.method)
|
||||
(behavior
|
||||
(identifier) @function.method)
|
||||
|
||||
(behavior (identifier) @function.method)
|
||||
(ffi_method
|
||||
(identifier) @function.method)
|
||||
|
||||
(ffi_method (identifier) @function.method)
|
||||
|
||||
((ffi_method (string) @string.special)
|
||||
((ffi_method
|
||||
(string) @string.special)
|
||||
(#set! "priority" 105))
|
||||
|
||||
(call_expression
|
||||
callee:
|
||||
[
|
||||
(identifier) @function.method.call
|
||||
(ffi_identifier (identifier) @function.method.call)
|
||||
(member_expression "." (identifier) @function.method.call)
|
||||
(ffi_identifier
|
||||
(identifier) @function.method.call)
|
||||
(member_expression
|
||||
"."
|
||||
(identifier) @function.method.call)
|
||||
])
|
||||
|
||||
; Parameters
|
||||
(parameter
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
(parameter name: (identifier) @variable.parameter)
|
||||
(lambda_parameter name: (identifier) @variable.parameter)
|
||||
(lambda_parameter
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
; Types
|
||||
(type_alias
|
||||
(identifier) @type.definition)
|
||||
|
||||
(type_alias (identifier) @type.definition)
|
||||
(base_type
|
||||
name: (identifier) @type)
|
||||
|
||||
(base_type name: (identifier) @type)
|
||||
(generic_parameter
|
||||
(identifier) @type)
|
||||
|
||||
(generic_parameter (identifier) @type)
|
||||
|
||||
(lambda_type (identifier)? @function.method)
|
||||
(lambda_type
|
||||
(identifier)? @function.method)
|
||||
|
||||
((identifier) @type
|
||||
(#lua-match? @type "^_*[A-Z][a-zA-Z0-9_]*$"))
|
||||
|
||||
; Operators
|
||||
|
||||
(unary_expression
|
||||
operator: ["not" "addressof" "digestof"] @keyword.operator)
|
||||
operator:
|
||||
[
|
||||
"not"
|
||||
"addressof"
|
||||
"digestof"
|
||||
] @keyword.operator)
|
||||
|
||||
(binary_expression
|
||||
operator: ["and" "or" "xor" "is" "isnt"] @keyword.operator)
|
||||
operator:
|
||||
[
|
||||
"and"
|
||||
"or"
|
||||
"xor"
|
||||
"is"
|
||||
"isnt"
|
||||
] @keyword.operator)
|
||||
|
||||
[
|
||||
"="
|
||||
|
|
@ -213,35 +229,57 @@
|
|||
] @operator
|
||||
|
||||
; Literals
|
||||
|
||||
(string) @string
|
||||
|
||||
(source_file (string) @string.documentation)
|
||||
(actor_definition (string) @string.documentation)
|
||||
(class_definition (string) @string.documentation)
|
||||
(primitive_definition (string) @string.documentation)
|
||||
(interface_definition (string) @string.documentation)
|
||||
(trait_definition (string) @string.documentation)
|
||||
(struct_definition (string) @string.documentation)
|
||||
(type_alias (string) @string.documentation)
|
||||
(field (string) @string.documentation)
|
||||
(source_file
|
||||
(string) @string.documentation)
|
||||
|
||||
(actor_definition
|
||||
(string) @string.documentation)
|
||||
|
||||
(class_definition
|
||||
(string) @string.documentation)
|
||||
|
||||
(primitive_definition
|
||||
(string) @string.documentation)
|
||||
|
||||
(interface_definition
|
||||
(string) @string.documentation)
|
||||
|
||||
(trait_definition
|
||||
(string) @string.documentation)
|
||||
|
||||
(struct_definition
|
||||
(string) @string.documentation)
|
||||
|
||||
(type_alias
|
||||
(string) @string.documentation)
|
||||
|
||||
(field
|
||||
(string) @string.documentation)
|
||||
|
||||
(constructor
|
||||
[
|
||||
(string) @string.documentation
|
||||
(block . (string) @string.documentation)
|
||||
(string) @string.documentation
|
||||
(block
|
||||
.
|
||||
(string) @string.documentation)
|
||||
])
|
||||
|
||||
(method
|
||||
[
|
||||
(string) @string.documentation
|
||||
(block . (string) @string.documentation)
|
||||
(string) @string.documentation
|
||||
(block
|
||||
.
|
||||
(string) @string.documentation)
|
||||
])
|
||||
|
||||
(behavior
|
||||
[
|
||||
(string) @string.documentation
|
||||
(block . (string) @string.documentation)
|
||||
(string) @string.documentation
|
||||
(block
|
||||
.
|
||||
(string) @string.documentation)
|
||||
])
|
||||
|
||||
(character) @character
|
||||
|
|
@ -255,12 +293,20 @@
|
|||
(boolean) @boolean
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[ "{" "}" ] @punctuation.bracket
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[ "[" "]" ] @punctuation.bracket
|
||||
|
||||
[ "(" ")" ] @punctuation.bracket
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"."
|
||||
|
|
@ -281,7 +327,6 @@
|
|||
] @punctuation.special
|
||||
|
||||
; Comments
|
||||
|
||||
[
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
|
|
|
|||
|
|
@ -1,18 +1,15 @@
|
|||
[
|
||||
(use_statement)
|
||||
(use_statement)
|
||||
(actor_definition)
|
||||
(class_definition)
|
||||
(primitive_definition)
|
||||
(interface_definition)
|
||||
(trait_definition)
|
||||
(struct_definition)
|
||||
|
||||
(constructor)
|
||||
(method)
|
||||
(behavior)
|
||||
|
||||
(parameters)
|
||||
|
||||
(if_block)
|
||||
(then_block)
|
||||
(elseif_block)
|
||||
|
|
@ -23,22 +20,27 @@
|
|||
(match_statement)
|
||||
(parenthesized_expression)
|
||||
(tuple_expression)
|
||||
|
||||
(array_literal)
|
||||
(object_literal)
|
||||
] @indent.begin
|
||||
|
||||
(try_statement (block) @indent.begin)
|
||||
(try_statement
|
||||
(block) @indent.begin)
|
||||
|
||||
(repeat_statement (block) @indent.begin)
|
||||
(repeat_statement
|
||||
(block) @indent.begin)
|
||||
|
||||
(recover_statement (block) @indent.begin)
|
||||
(recover_statement
|
||||
(block) @indent.begin)
|
||||
|
||||
(return_statement (block) @indent.begin)
|
||||
(return_statement
|
||||
(block) @indent.begin)
|
||||
|
||||
(continue_statement (block) @indent.begin)
|
||||
(continue_statement
|
||||
(block) @indent.begin)
|
||||
|
||||
(break_statement (block) @indent.begin)
|
||||
(break_statement
|
||||
(block) @indent.begin)
|
||||
|
||||
[
|
||||
"}"
|
||||
|
|
@ -46,11 +48,20 @@
|
|||
")"
|
||||
] @indent.end
|
||||
|
||||
[ "{" "}" ] @indent.branch
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @indent.branch
|
||||
|
||||
[ "[" "]" ] @indent.branch
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @indent.branch
|
||||
|
||||
[ "(" ")" ] @indent.branch
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
([
|
||||
(line_comment)
|
||||
(block_comment)
|
||||
] @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
] @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
|
|
|||
|
|
@ -1,18 +1,15 @@
|
|||
; Scopes
|
||||
|
||||
[
|
||||
(use_statement)
|
||||
(use_statement)
|
||||
(actor_definition)
|
||||
(class_definition)
|
||||
(primitive_definition)
|
||||
(interface_definition)
|
||||
(trait_definition)
|
||||
(struct_definition)
|
||||
|
||||
(constructor)
|
||||
(method)
|
||||
(behavior)
|
||||
|
||||
(if_statement)
|
||||
(iftype_statement)
|
||||
(elseif_block)
|
||||
|
|
@ -28,17 +25,14 @@
|
|||
(case_statement)
|
||||
(parenthesized_expression)
|
||||
(tuple_expression)
|
||||
|
||||
(array_literal)
|
||||
(object_literal)
|
||||
(object_literal)
|
||||
] @local.scope
|
||||
|
||||
; References
|
||||
|
||||
(identifier) @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(field
|
||||
name: (identifier) @local.definition.field)
|
||||
|
||||
|
|
@ -84,8 +78,9 @@
|
|||
(for_statement
|
||||
[
|
||||
(identifier) @local.definition.var
|
||||
(tuple_expression (identifier) @local.definition.var)
|
||||
(tuple_expression
|
||||
(identifier) @local.definition.var)
|
||||
])
|
||||
|
||||
(with_elem
|
||||
(with_elem
|
||||
(identifier) @local.definition.var)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue