mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20: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,44 +1,44 @@
|
|||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; Types
|
||||
|
||||
(type) @type
|
||||
|
||||
(scoped_type_identifier
|
||||
(identifier) . (identifier) @type)
|
||||
(identifier)
|
||||
.
|
||||
(identifier) @type)
|
||||
|
||||
(struct_literal
|
||||
. (identifier) @type)
|
||||
.
|
||||
(identifier) @type)
|
||||
|
||||
(builtin_type) @type.builtin
|
||||
|
||||
; Constants
|
||||
|
||||
((identifier) @constant
|
||||
(#lua-match? @constant "^[A-Z_]+$"))
|
||||
|
||||
; Includes
|
||||
|
||||
[
|
||||
"use"
|
||||
] @keyword.import
|
||||
"use" @keyword.import
|
||||
|
||||
(use_statement
|
||||
(scoped_type_identifier
|
||||
(identifier) @module))
|
||||
|
||||
(use_statement
|
||||
(identifier) @module "{")
|
||||
(identifier) @module
|
||||
"{")
|
||||
|
||||
(use_statement
|
||||
. (identifier) @module .)
|
||||
.
|
||||
(identifier) @module .)
|
||||
|
||||
((scoped_type_identifier
|
||||
path: (_) @module)
|
||||
(#set! "priority" 105))
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"def"
|
||||
"enum"
|
||||
|
|
@ -49,9 +49,7 @@
|
|||
"union"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"fn"
|
||||
] @keyword.function
|
||||
"fn" @keyword.function
|
||||
|
||||
[
|
||||
"defer"
|
||||
|
|
@ -65,12 +63,13 @@
|
|||
] @keyword.operator
|
||||
|
||||
; Typedefs
|
||||
|
||||
(type_declaration
|
||||
"type" (identifier) @type.definition . "=")
|
||||
"type"
|
||||
(identifier) @type.definition
|
||||
.
|
||||
"=")
|
||||
|
||||
; Qualifiers
|
||||
|
||||
[
|
||||
"const"
|
||||
"static"
|
||||
|
|
@ -78,7 +77,6 @@
|
|||
] @type.qualifier
|
||||
|
||||
; Attributes
|
||||
|
||||
[
|
||||
"@fini"
|
||||
"@init"
|
||||
|
|
@ -89,62 +87,72 @@
|
|||
] @attribute
|
||||
|
||||
; Labels
|
||||
|
||||
((label) @label
|
||||
(#set! "priority" 105))
|
||||
|
||||
; Functions
|
||||
|
||||
(function_declaration
|
||||
"fn" . (identifier) @function)
|
||||
"fn"
|
||||
.
|
||||
(identifier) @function)
|
||||
|
||||
(call_expression
|
||||
. (identifier) @function.call)
|
||||
.
|
||||
(identifier) @function.call)
|
||||
|
||||
(call_expression
|
||||
. (scoped_type_identifier
|
||||
. (identifier) . "::" . (identifier) @function.method.call))
|
||||
.
|
||||
(scoped_type_identifier
|
||||
.
|
||||
(identifier)
|
||||
.
|
||||
"::"
|
||||
.
|
||||
(identifier) @function.method.call))
|
||||
|
||||
((call_expression
|
||||
. (identifier) @function.builtin)
|
||||
.
|
||||
(identifier) @function.builtin)
|
||||
(#any-of? @function.builtin "align" "assert" "free" "len" "offset" "size"))
|
||||
|
||||
(size_expression
|
||||
"size" @function.builtin)
|
||||
|
||||
((function_declaration
|
||||
"fn" . (identifier) @constructor)
|
||||
"fn"
|
||||
.
|
||||
(identifier) @constructor)
|
||||
(#eq? @constructor "init"))
|
||||
|
||||
((call_expression
|
||||
. (identifier) @constructor)
|
||||
.
|
||||
(identifier) @constructor)
|
||||
(#eq? @constructor "init"))
|
||||
|
||||
; Parameters
|
||||
|
||||
(parameter
|
||||
(_) @variable.parameter . ":")
|
||||
(_) @variable.parameter
|
||||
.
|
||||
":")
|
||||
|
||||
; Fields
|
||||
|
||||
((member_expression
|
||||
"." (_) @variable.member)
|
||||
"."
|
||||
(_) @variable.member)
|
||||
(#set! "priority" 105))
|
||||
|
||||
(field
|
||||
. (identifier) @variable.member)
|
||||
.
|
||||
(identifier) @variable.member)
|
||||
|
||||
(field_assignment
|
||||
. (identifier) @variable.member)
|
||||
.
|
||||
(identifier) @variable.member)
|
||||
|
||||
; Repeats
|
||||
|
||||
[
|
||||
"for"
|
||||
] @keyword.repeat
|
||||
"for" @keyword.repeat
|
||||
|
||||
; Conditionals
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
|
|
@ -155,7 +163,6 @@
|
|||
] @keyword.conditional
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
|
|
@ -196,12 +203,20 @@
|
|||
] @operator
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[ "{" "}" ] @punctuation.bracket
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[ "[" "]" ] @punctuation.bracket
|
||||
|
||||
[ "(" ")" ] @punctuation.bracket
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
".."
|
||||
|
|
@ -209,11 +224,14 @@
|
|||
"_"
|
||||
] @punctuation.special
|
||||
|
||||
(pointer_type "*" @punctuation.special)
|
||||
(pointer_type
|
||||
"*" @punctuation.special)
|
||||
|
||||
(slice_type "*" @punctuation.special)
|
||||
(slice_type
|
||||
"*" @punctuation.special)
|
||||
|
||||
(error_type "!" @punctuation.special)
|
||||
(error_type
|
||||
"!" @punctuation.special)
|
||||
|
||||
[
|
||||
","
|
||||
|
|
@ -225,7 +243,6 @@
|
|||
] @punctuation.delimiter
|
||||
|
||||
; Literals
|
||||
|
||||
[
|
||||
(string)
|
||||
(raw_string)
|
||||
|
|
@ -247,5 +264,4 @@
|
|||
] @constant.builtin
|
||||
|
||||
; Comments
|
||||
|
||||
(comment) @comment @spell
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue