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
|
|
@ -1,15 +1,16 @@
|
|||
(call_expression (block) @fold)
|
||||
(call_expression
|
||||
(block) @fold)
|
||||
|
||||
[(class_definition)
|
||||
(trait_definition)
|
||||
(object_definition)
|
||||
(function_definition)
|
||||
(val_definition)
|
||||
(import_declaration)
|
||||
|
||||
(while_expression)
|
||||
(do_while_expression)
|
||||
(for_expression)
|
||||
(try_expression)
|
||||
(match_expression)
|
||||
[
|
||||
(class_definition)
|
||||
(trait_definition)
|
||||
(object_definition)
|
||||
(function_definition)
|
||||
(val_definition)
|
||||
(import_declaration)
|
||||
(while_expression)
|
||||
(do_while_expression)
|
||||
(for_expression)
|
||||
(try_expression)
|
||||
(match_expression)
|
||||
] @fold
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
; CREDITS @stumash (stuart.mashaal@gmail.com)
|
||||
|
||||
(class_definition
|
||||
name: (identifier) @type)
|
||||
|
||||
|
|
@ -18,25 +17,26 @@
|
|||
(simple_enum_case
|
||||
name: (identifier) @type)
|
||||
|
||||
;; variables
|
||||
|
||||
(class_parameter
|
||||
; variables
|
||||
(class_parameter
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
(self_type (identifier) @variable.parameter)
|
||||
(self_type
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
(interpolation (identifier) @none)
|
||||
(interpolation (block) @none)
|
||||
(interpolation
|
||||
(identifier) @none)
|
||||
|
||||
;; types
|
||||
(interpolation
|
||||
(block) @none)
|
||||
|
||||
; types
|
||||
(type_definition
|
||||
name: (type_identifier) @type.definition)
|
||||
|
||||
(type_identifier) @type
|
||||
|
||||
;; val/var definitions/declarations
|
||||
|
||||
; val/var definitions/declarations
|
||||
(val_definition
|
||||
pattern: (identifier) @variable)
|
||||
|
||||
|
|
@ -50,35 +50,46 @@
|
|||
name: (identifier) @variable)
|
||||
|
||||
; method definition
|
||||
|
||||
(function_declaration
|
||||
name: (identifier) @function.method)
|
||||
name: (identifier) @function.method)
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @function.method)
|
||||
name: (identifier) @function.method)
|
||||
|
||||
; imports/exports
|
||||
|
||||
(import_declaration
|
||||
path: (identifier) @module)
|
||||
((stable_identifier (identifier) @module))
|
||||
|
||||
((stable_identifier
|
||||
(identifier) @module))
|
||||
|
||||
((import_declaration
|
||||
path: (identifier) @type) (#lua-match? @type "^[A-Z]"))
|
||||
((stable_identifier (identifier) @type) (#lua-match? @type "^[A-Z]"))
|
||||
path: (identifier) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
((stable_identifier
|
||||
(identifier) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
(export_declaration
|
||||
path: (identifier) @module)
|
||||
((stable_identifier (identifier) @module))
|
||||
|
||||
((stable_identifier
|
||||
(identifier) @module))
|
||||
|
||||
((export_declaration
|
||||
path: (identifier) @type) (#lua-match? @type "^[A-Z]"))
|
||||
((stable_identifier (identifier) @type) (#lua-match? @type "^[A-Z]"))
|
||||
path: (identifier) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
((namespace_selectors (identifier) @type) (#lua-match? @type "^[A-Z]"))
|
||||
((stable_identifier
|
||||
(identifier) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
((namespace_selectors
|
||||
(identifier) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
; method invocation
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.call)
|
||||
|
||||
|
|
@ -86,12 +97,13 @@
|
|||
function: (operator_identifier) @function.call)
|
||||
|
||||
(call_expression
|
||||
function: (field_expression
|
||||
field: (identifier) @function.method.call))
|
||||
function:
|
||||
(field_expression
|
||||
field: (identifier) @function.method.call))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @constructor)
|
||||
(#lua-match? @constructor "^[A-Z]"))
|
||||
function: (identifier) @constructor)
|
||||
(#lua-match? @constructor "^[A-Z]"))
|
||||
|
||||
(generic_function
|
||||
function: (identifier) @function.call)
|
||||
|
|
@ -100,7 +112,6 @@
|
|||
interpolator: (identifier) @function.call)
|
||||
|
||||
; function definitions
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @function)
|
||||
|
||||
|
|
@ -111,20 +122,30 @@
|
|||
name: (identifier) @variable.parameter)
|
||||
|
||||
; expressions
|
||||
(field_expression
|
||||
field: (identifier) @property)
|
||||
|
||||
(field_expression field: (identifier) @property)
|
||||
(field_expression value: (identifier) @type
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
(field_expression
|
||||
value: (identifier) @type
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
(infix_expression operator: (identifier) @operator)
|
||||
(infix_expression operator: (operator_identifier) @operator)
|
||||
(infix_type operator: (operator_identifier) @operator)
|
||||
(infix_type operator: (operator_identifier) @operator)
|
||||
(infix_expression
|
||||
operator: (identifier) @operator)
|
||||
|
||||
(infix_expression
|
||||
operator: (operator_identifier) @operator)
|
||||
|
||||
(infix_type
|
||||
operator: (operator_identifier) @operator)
|
||||
|
||||
(infix_type
|
||||
operator: (operator_identifier) @operator)
|
||||
|
||||
; literals
|
||||
|
||||
(boolean_literal) @boolean
|
||||
|
||||
(integer_literal) @number
|
||||
|
||||
(floating_point_literal) @number.float
|
||||
|
||||
[
|
||||
|
|
@ -135,13 +156,16 @@
|
|||
|
||||
(symbol_literal) @string.special.symbol
|
||||
|
||||
(interpolation "$" @punctuation.special)
|
||||
|
||||
;; keywords
|
||||
(interpolation
|
||||
"$" @punctuation.special)
|
||||
|
||||
; keywords
|
||||
(opaque_modifier) @type.qualifier
|
||||
|
||||
(infix_modifier) @keyword
|
||||
|
||||
(transparent_modifier) @type.qualifier
|
||||
|
||||
(open_modifier) @type.qualifier
|
||||
|
||||
[
|
||||
|
|
@ -151,8 +175,8 @@
|
|||
"extends"
|
||||
"derives"
|
||||
"finally"
|
||||
;; `forSome` existential types not implemented yet
|
||||
;; `macro` not implemented yet
|
||||
; `forSome` existential types not implemented yet
|
||||
; `macro` not implemented yet
|
||||
"object"
|
||||
"override"
|
||||
"package"
|
||||
|
|
@ -186,8 +210,7 @@
|
|||
|
||||
(annotation) @attribute
|
||||
|
||||
;; special keywords
|
||||
|
||||
; special keywords
|
||||
"new" @keyword.operator
|
||||
|
||||
[
|
||||
|
|
@ -198,17 +221,17 @@
|
|||
] @keyword.conditional
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"."
|
||||
","
|
||||
"."
|
||||
","
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
|
|
@ -221,12 +244,15 @@
|
|||
"def" @keyword.function
|
||||
|
||||
[
|
||||
"=>"
|
||||
"<-"
|
||||
"@"
|
||||
"=>"
|
||||
"<-"
|
||||
"@"
|
||||
] @operator
|
||||
|
||||
["import" "export"] @keyword.import
|
||||
[
|
||||
"import"
|
||||
"export"
|
||||
] @keyword.import
|
||||
|
||||
[
|
||||
"try"
|
||||
|
|
@ -244,22 +270,23 @@
|
|||
((block_comment) @comment.documentation
|
||||
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
|
||||
|
||||
;; `case` is a conditional keyword in case_block
|
||||
|
||||
; `case` is a conditional keyword in case_block
|
||||
(case_block
|
||||
(case_clause ("case") @keyword.conditional))
|
||||
(case_clause
|
||||
("case") @keyword.conditional))
|
||||
|
||||
(operator_identifier) @operator
|
||||
|
||||
((identifier) @type (#lua-match? @type "^[A-Z]"))
|
||||
((identifier) @type
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#lua-match? @variable.builtin "^this$"))
|
||||
(#lua-match? @variable.builtin "^this$"))
|
||||
|
||||
(
|
||||
(identifier) @function.builtin
|
||||
(#lua-match? @function.builtin "^super$")
|
||||
)
|
||||
((identifier) @function.builtin
|
||||
(#lua-match? @function.builtin "^super$"))
|
||||
|
||||
;; Scala CLI using directives
|
||||
; Scala CLI using directives
|
||||
(using_directive_key) @variable.parameter
|
||||
|
||||
(using_directive_value) @string
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((block_comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
(#set! injection.language "comment"))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
; Scopes
|
||||
|
||||
[
|
||||
(template_body)
|
||||
(lambda_expression)
|
||||
|
|
@ -9,16 +8,15 @@
|
|||
] @local.scope
|
||||
|
||||
; References
|
||||
|
||||
(identifier) @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
(function_declaration
|
||||
name: (identifier) @local.definition.function)
|
||||
|
||||
(function_definition
|
||||
name: ((identifier) @local.definition.function)
|
||||
name:
|
||||
((identifier) @local.definition.function)
|
||||
(#set! definition.var.scope parent))
|
||||
|
||||
(parameter
|
||||
|
|
@ -46,7 +44,8 @@
|
|||
name: (identifier) @local.definition.var)
|
||||
|
||||
(for_expression
|
||||
enumerators: (enumerators
|
||||
(enumerator
|
||||
(tuple_pattern
|
||||
(identifier) @local.definition.var))))
|
||||
enumerators:
|
||||
(enumerators
|
||||
(enumerator
|
||||
(tuple_pattern
|
||||
(identifier) @local.definition.var))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue