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
|
|
@ -1,12 +1,12 @@
|
|||
; Pragma
|
||||
|
||||
[
|
||||
"pragma"
|
||||
"pragma"
|
||||
"solidity"
|
||||
] @keyword.directive
|
||||
|
||||
(solidity_pragma_token
|
||||
"||" @string.special.symbol)
|
||||
|
||||
(solidity_pragma_token
|
||||
"-" @string.special.symbol)
|
||||
|
||||
|
|
@ -15,10 +15,9 @@
|
|||
(solidity_version) @string.special
|
||||
|
||||
; Literals
|
||||
|
||||
[
|
||||
(string)
|
||||
(yul_string_literal)
|
||||
(string)
|
||||
(yul_string_literal)
|
||||
] @string
|
||||
|
||||
(hex_string_literal
|
||||
|
|
@ -30,77 +29,114 @@
|
|||
(_) @string)
|
||||
|
||||
[
|
||||
(number_literal)
|
||||
(yul_decimal_number)
|
||||
(yul_hex_number)
|
||||
(number_literal)
|
||||
(yul_decimal_number)
|
||||
(yul_hex_number)
|
||||
] @number
|
||||
|
||||
(yul_boolean) @boolean
|
||||
|
||||
; Variables
|
||||
|
||||
[
|
||||
(identifier)
|
||||
(yul_identifier)
|
||||
] @variable
|
||||
|
||||
; Types
|
||||
(type_name
|
||||
(identifier) @type)
|
||||
|
||||
(type_name (identifier) @type)
|
||||
(type_name (user_defined_type (identifier) @type))
|
||||
(type_name "mapping" @function.builtin)
|
||||
(type_name
|
||||
(user_defined_type
|
||||
(identifier) @type))
|
||||
|
||||
(type_name
|
||||
"mapping" @function.builtin)
|
||||
|
||||
[
|
||||
(primitive_type)
|
||||
(number_unit)
|
||||
] @type.builtin
|
||||
|
||||
(contract_declaration name: (identifier) @type)
|
||||
(struct_declaration name: (identifier) @type)
|
||||
(struct_member name: (identifier) @variable.member)
|
||||
(enum_declaration name: (identifier) @type)
|
||||
(emit_statement . (identifier) @type)
|
||||
(contract_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(struct_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(struct_member
|
||||
name: (identifier) @variable.member)
|
||||
|
||||
(enum_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(emit_statement
|
||||
.
|
||||
(identifier) @type)
|
||||
|
||||
; Handles ContractA, ContractB in function foo() override(ContractA, contractB) {}
|
||||
(override_specifier (user_defined_type) @type)
|
||||
(override_specifier
|
||||
(user_defined_type) @type)
|
||||
|
||||
; Functions and parameters
|
||||
|
||||
(function_definition
|
||||
name: (identifier) @function)
|
||||
|
||||
(modifier_definition
|
||||
name: (identifier) @function)
|
||||
|
||||
(yul_evm_builtin) @function.builtin
|
||||
|
||||
; Use constructor coloring for special functions
|
||||
(constructor_definition "constructor" @constructor)
|
||||
(constructor_definition
|
||||
"constructor" @constructor)
|
||||
|
||||
(modifier_invocation (identifier) @function)
|
||||
(modifier_invocation
|
||||
(identifier) @function)
|
||||
|
||||
; Handles expressions like structVariable.g();
|
||||
(call_expression . (member_expression (identifier) @function.method.call))
|
||||
(call_expression
|
||||
.
|
||||
(member_expression
|
||||
(identifier) @function.method.call))
|
||||
|
||||
; Handles expressions like g();
|
||||
(call_expression . (identifier) @function.call)
|
||||
(call_expression
|
||||
.
|
||||
(identifier) @function.call)
|
||||
|
||||
; Function parameters
|
||||
(event_paramater name: (identifier) @variable.parameter)
|
||||
(parameter name: (identifier) @variable.parameter)
|
||||
(event_paramater
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
(parameter
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
; Yul functions
|
||||
(yul_function_call function: (yul_identifier) @function.call)
|
||||
(yul_function_call
|
||||
function: (yul_identifier) @function.call)
|
||||
|
||||
; Yul function parameters
|
||||
(yul_function_definition . (yul_identifier) @function (yul_identifier) @variable.parameter)
|
||||
(yul_function_definition
|
||||
.
|
||||
(yul_identifier) @function
|
||||
(yul_identifier) @variable.parameter)
|
||||
|
||||
(meta_type_expression "type" @keyword)
|
||||
(meta_type_expression
|
||||
"type" @keyword)
|
||||
|
||||
(member_expression
|
||||
property: (identifier) @variable.member)
|
||||
|
||||
(call_struct_argument
|
||||
name: (identifier) @variable.member)
|
||||
|
||||
(struct_field_assignment
|
||||
name: (identifier) @variable.member)
|
||||
|
||||
(member_expression property: (identifier) @variable.member)
|
||||
(call_struct_argument name: (identifier) @variable.member)
|
||||
(struct_field_assignment name: (identifier) @variable.member)
|
||||
(enum_value) @constant
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"contract"
|
||||
"interface"
|
||||
|
|
@ -124,8 +160,8 @@
|
|||
|
||||
; FIXME: update grammar
|
||||
; (block_statement "unchecked" @keyword)
|
||||
|
||||
(event_paramater "indexed" @keyword)
|
||||
(event_paramater
|
||||
"indexed" @keyword)
|
||||
|
||||
[
|
||||
"public"
|
||||
|
|
@ -180,21 +216,35 @@
|
|||
"function" @keyword.function
|
||||
|
||||
[
|
||||
"import"
|
||||
"import"
|
||||
"using"
|
||||
] @keyword.import
|
||||
(import_directive "as" @keyword.import)
|
||||
(import_directive "from" @keyword.import)
|
||||
((import_directive source: (string) @string.special.path)
|
||||
|
||||
(import_directive
|
||||
"as" @keyword.import)
|
||||
|
||||
(import_directive
|
||||
"from" @keyword.import)
|
||||
|
||||
((import_directive
|
||||
source: (string) @string.special.path)
|
||||
(#offset! @string.special.path 0 1 0 -1))
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[ "{" "}" ] @punctuation.bracket
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[ "[" "]" ] @punctuation.bracket
|
||||
|
||||
[ "(" ")" ] @punctuation.bracket
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"."
|
||||
|
|
@ -207,7 +257,6 @@
|
|||
] @punctuation.delimiter
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"&&"
|
||||
"||"
|
||||
|
|
@ -245,14 +294,15 @@
|
|||
"new"
|
||||
] @keyword.operator
|
||||
|
||||
(import_directive "*" @character.special)
|
||||
(import_directive
|
||||
"*" @character.special)
|
||||
|
||||
; Comments
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
((comment) @comment.documentation
|
||||
(#lua-match? @comment.documentation "^///[^/]"))
|
||||
|
||||
((comment) @comment.documentation
|
||||
(#lua-match? @comment.documentation "^///$"))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue