mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-05 21:10:15 -04:00
chore: query formatting
This commit is contained in:
parent
79975d6557
commit
57a8acf0c4
674 changed files with 18466 additions and 12648 deletions
|
|
@ -1,14 +1,13 @@
|
|||
; inherits: c
|
||||
|
||||
[
|
||||
(for_range_loop)
|
||||
(class_specifier)
|
||||
(field_declaration
|
||||
type: (enum_specifier)
|
||||
default_value: (initializer_list))
|
||||
(template_declaration)
|
||||
(namespace_definition)
|
||||
(try_statement)
|
||||
(catch_clause)
|
||||
(lambda_expression)
|
||||
(for_range_loop)
|
||||
(class_specifier)
|
||||
(field_declaration
|
||||
type: (enum_specifier)
|
||||
default_value: (initializer_list))
|
||||
(template_declaration)
|
||||
(namespace_definition)
|
||||
(try_statement)
|
||||
(catch_clause)
|
||||
(lambda_expression)
|
||||
] @fold
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
; inherits: c
|
||||
|
||||
((identifier) @variable.member
|
||||
(#lua-match? @variable.member "^m_.*$"))
|
||||
|
||||
|
|
@ -8,23 +7,24 @@
|
|||
|
||||
; function(Foo ...foo)
|
||||
(variadic_parameter_declaration
|
||||
declarator: (variadic_declarator
|
||||
(_) @variable.parameter))
|
||||
declarator:
|
||||
(variadic_declarator
|
||||
(_) @variable.parameter))
|
||||
|
||||
; int foo = 0
|
||||
(optional_parameter_declaration
|
||||
declarator: (_) @variable.parameter)
|
||||
declarator: (_) @variable.parameter)
|
||||
|
||||
;(field_expression) @variable.parameter ;; How to highlight this?
|
||||
|
||||
(((field_expression
|
||||
(field_identifier) @function.method)) @_parent
|
||||
(#has-parent? @_parent template_method function_declarator))
|
||||
(field_identifier) @function.method)) @_parent
|
||||
(#has-parent? @_parent template_method function_declarator))
|
||||
|
||||
(field_declaration
|
||||
(field_identifier) @variable.member)
|
||||
|
||||
(field_initializer
|
||||
(field_identifier) @property)
|
||||
(field_identifier) @property)
|
||||
|
||||
(function_declarator
|
||||
declarator: (field_identifier) @function.method)
|
||||
|
|
@ -38,13 +38,25 @@
|
|||
(auto) @type.builtin
|
||||
|
||||
(namespace_identifier) @module
|
||||
|
||||
((namespace_identifier) @type
|
||||
(#lua-match? @type "^[%u]"))
|
||||
|
||||
(case_statement
|
||||
value: (qualified_identifier (identifier) @constant))
|
||||
value:
|
||||
(qualified_identifier
|
||||
(identifier) @constant))
|
||||
|
||||
(using_declaration . "using" . "namespace" . [(qualified_identifier) (identifier)] @module)
|
||||
(using_declaration
|
||||
.
|
||||
"using"
|
||||
.
|
||||
"namespace"
|
||||
.
|
||||
[
|
||||
(qualified_identifier)
|
||||
(identifier)
|
||||
] @module)
|
||||
|
||||
(destructor_name
|
||||
(identifier) @function.method)
|
||||
|
|
@ -53,15 +65,18 @@
|
|||
(function_declarator
|
||||
(qualified_identifier
|
||||
(identifier) @function))
|
||||
|
||||
(function_declarator
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(identifier) @function)))
|
||||
|
||||
(function_declarator
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(identifier) @function))))
|
||||
|
||||
((qualified_identifier
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
|
|
@ -74,21 +89,26 @@
|
|||
(identifier) @function))
|
||||
|
||||
(operator_name) @function
|
||||
|
||||
"operator" @function
|
||||
|
||||
"static_assert" @function.builtin
|
||||
|
||||
(call_expression
|
||||
(qualified_identifier
|
||||
(identifier) @function.call))
|
||||
|
||||
(call_expression
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(identifier) @function.call)))
|
||||
|
||||
(call_expression
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(identifier) @function.call))))
|
||||
|
||||
((qualified_identifier
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
|
|
@ -99,21 +119,25 @@
|
|||
(call_expression
|
||||
(template_function
|
||||
(identifier) @function.call))
|
||||
|
||||
(call_expression
|
||||
(qualified_identifier
|
||||
(template_function
|
||||
(identifier) @function.call)))
|
||||
|
||||
(call_expression
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(template_function
|
||||
(identifier) @function.call))))
|
||||
|
||||
(call_expression
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
(template_function
|
||||
(identifier) @function.call)))))
|
||||
|
||||
((qualified_identifier
|
||||
(qualified_identifier
|
||||
(qualified_identifier
|
||||
|
|
@ -126,12 +150,12 @@
|
|||
(function_declarator
|
||||
(template_method
|
||||
(field_identifier) @function.method))
|
||||
|
||||
(call_expression
|
||||
(field_expression
|
||||
(field_identifier) @function.method.call))
|
||||
|
||||
; constructors
|
||||
|
||||
((function_declarator
|
||||
(qualified_identifier
|
||||
(identifier) @constructor))
|
||||
|
|
@ -139,93 +163,91 @@
|
|||
|
||||
((call_expression
|
||||
function: (identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
((call_expression
|
||||
function: (qualified_identifier
|
||||
name: (identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
function:
|
||||
(qualified_identifier
|
||||
name: (identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
;; constructing a type in an initializer list: Constructor (): **SuperType (1)**
|
||||
((call_expression
|
||||
function:
|
||||
(field_expression
|
||||
field: (field_identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
; constructing a type in an initializer list: Constructor (): **SuperType (1)**
|
||||
((field_initializer
|
||||
(field_identifier) @constructor
|
||||
(argument_list))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
; Constants
|
||||
|
||||
(this) @variable.builtin
|
||||
(null "nullptr" @constant.builtin)
|
||||
|
||||
(null
|
||||
"nullptr" @constant.builtin)
|
||||
|
||||
(true) @boolean
|
||||
|
||||
(false) @boolean
|
||||
|
||||
; Literals
|
||||
|
||||
(raw_string_literal) @string
|
||||
(raw_string_literal) @string
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"try"
|
||||
"catch"
|
||||
"noexcept"
|
||||
"throw"
|
||||
"try"
|
||||
"catch"
|
||||
"noexcept"
|
||||
"throw"
|
||||
] @keyword.exception
|
||||
|
||||
|
||||
[
|
||||
"class"
|
||||
"decltype"
|
||||
"explicit"
|
||||
"friend"
|
||||
"namespace"
|
||||
"override"
|
||||
"template"
|
||||
"typename"
|
||||
"using"
|
||||
"concept"
|
||||
"requires"
|
||||
"constexpr"
|
||||
"class"
|
||||
"decltype"
|
||||
"explicit"
|
||||
"friend"
|
||||
"namespace"
|
||||
"override"
|
||||
"template"
|
||||
"typename"
|
||||
"using"
|
||||
"concept"
|
||||
"requires"
|
||||
"constexpr"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"co_await"
|
||||
] @keyword.coroutine
|
||||
"co_await" @keyword.coroutine
|
||||
|
||||
[
|
||||
"co_yield"
|
||||
"co_return"
|
||||
"co_yield"
|
||||
"co_return"
|
||||
] @keyword.coroutine.return
|
||||
|
||||
[
|
||||
"public"
|
||||
"private"
|
||||
"protected"
|
||||
"virtual"
|
||||
"final"
|
||||
"public"
|
||||
"private"
|
||||
"protected"
|
||||
"virtual"
|
||||
"final"
|
||||
] @type.qualifier
|
||||
|
||||
[
|
||||
"new"
|
||||
"delete"
|
||||
|
||||
"xor"
|
||||
"bitand"
|
||||
"bitor"
|
||||
"compl"
|
||||
"not"
|
||||
"xor_eq"
|
||||
"and_eq"
|
||||
"or_eq"
|
||||
"not_eq"
|
||||
"and"
|
||||
"or"
|
||||
"new"
|
||||
"delete"
|
||||
"xor"
|
||||
"bitand"
|
||||
"bitor"
|
||||
"compl"
|
||||
"not"
|
||||
"xor_eq"
|
||||
"and_eq"
|
||||
"or_eq"
|
||||
"not_eq"
|
||||
"and"
|
||||
"or"
|
||||
] @keyword.operator
|
||||
|
||||
"<=>" @operator
|
||||
|
|
@ -233,9 +255,15 @@
|
|||
"::" @punctuation.delimiter
|
||||
|
||||
(template_argument_list
|
||||
["<" ">"] @punctuation.bracket)
|
||||
[
|
||||
"<"
|
||||
">"
|
||||
] @punctuation.bracket)
|
||||
|
||||
(template_parameter_list
|
||||
["<" ">"] @punctuation.bracket)
|
||||
[
|
||||
"<"
|
||||
">"
|
||||
] @punctuation.bracket)
|
||||
|
||||
(literal_suffix) @operator
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
; inherits: c
|
||||
|
||||
[
|
||||
(condition_clause)
|
||||
] @indent.begin
|
||||
(condition_clause) @indent.begin
|
||||
|
||||
((field_initializer_list) @indent.begin
|
||||
(#set! indent.start_at_same_line 1))
|
||||
|
||||
(access_specifier) @indent.branch
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
((preproc_arg) @injection.content
|
||||
(#set! injection.language "cpp"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
(#set! injection.language "cpp"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#lua-match? @injection.content "/[*][!<*][^a-zA-Z]")
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
; inherits: c
|
||||
|
||||
;; Parameters
|
||||
; Parameters
|
||||
(variadic_parameter_declaration
|
||||
declarator: (variadic_declarator
|
||||
(identifier) @local.definition.parameter))
|
||||
declarator:
|
||||
(variadic_declarator
|
||||
(identifier) @local.definition.parameter))
|
||||
|
||||
(optional_parameter_declaration
|
||||
declarator: (identifier) @local.definition.parameter)
|
||||
;; Class / struct definitions
|
||||
|
||||
; Class / struct definitions
|
||||
(class_specifier) @local.scope
|
||||
|
||||
(reference_declarator
|
||||
|
|
@ -16,8 +18,9 @@
|
|||
(identifier) @local.definition.var)
|
||||
|
||||
(struct_specifier
|
||||
name: (qualified_identifier
|
||||
name: (type_identifier) @local.definition.type))
|
||||
name:
|
||||
(qualified_identifier
|
||||
name: (type_identifier) @local.definition.type))
|
||||
|
||||
(class_specifier
|
||||
name: (type_identifier) @local.definition.type)
|
||||
|
|
@ -26,8 +29,9 @@
|
|||
name: (identifier) @local.definition.type)
|
||||
|
||||
(class_specifier
|
||||
name: (qualified_identifier
|
||||
name: (type_identifier) @local.definition.type))
|
||||
name:
|
||||
(qualified_identifier
|
||||
name: (type_identifier) @local.definition.type))
|
||||
|
||||
(alias_declaration
|
||||
name: (type_identifier) @local.definition.type)
|
||||
|
|
@ -35,9 +39,10 @@
|
|||
;template <typename T>
|
||||
(type_parameter_declaration
|
||||
(type_identifier) @local.definition.type)
|
||||
|
||||
(template_declaration) @local.scope
|
||||
|
||||
;; Namespaces
|
||||
; Namespaces
|
||||
(namespace_definition
|
||||
name: (namespace_identifier) @local.definition.namespace
|
||||
body: (_) @local.scope)
|
||||
|
|
@ -47,9 +52,9 @@
|
|||
body: (_) @local.scope)
|
||||
|
||||
((namespace_identifier) @local.reference
|
||||
(#set! reference.kind "namespace"))
|
||||
(#set! reference.kind "namespace"))
|
||||
|
||||
;; Function definitions
|
||||
; Function definitions
|
||||
(template_function
|
||||
name: (identifier) @local.definition.function) @local.scope
|
||||
|
||||
|
|
@ -57,16 +62,18 @@
|
|||
name: (field_identifier) @local.definition.method) @local.scope
|
||||
|
||||
(function_declarator
|
||||
declarator: (qualified_identifier
|
||||
name: (identifier) @local.definition.function)) @local.scope
|
||||
declarator:
|
||||
(qualified_identifier
|
||||
name: (identifier) @local.definition.function)) @local.scope
|
||||
|
||||
(field_declaration
|
||||
declarator: (function_declarator
|
||||
(field_identifier) @local.definition.method))
|
||||
declarator:
|
||||
(function_declarator
|
||||
(field_identifier) @local.definition.method))
|
||||
|
||||
(lambda_expression) @local.scope
|
||||
|
||||
;; Control structures
|
||||
; Control structures
|
||||
(try_statement
|
||||
body: (_) @local.scope)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue