Skip to content

Fix(solidity) Updated solidity highlights.scm #374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 19 additions & 21 deletions queries/solidity/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@
(type_name "(" @punctuation.bracket "=>" @punctuation.delimiter ")" @punctuation.bracket)

; Definitions
(struct_declaration
(struct_declaration
name: (identifier) @type)
(enum_declaration
(enum_declaration
name: (identifier) @type)
(contract_declaration
name: (identifier) @type)
name: (identifier) @type)
(library_declaration
name: (identifier) @type)
name: (identifier) @type)
(interface_declaration
name: (identifier) @type)
(event_definition
name: (identifier) @type)
(event_definition
name: (identifier) @type)

(function_definition
name: (identifier) @function)
Expand All @@ -68,26 +68,26 @@
(struct_member name: (identifier) @property)
(enum_value) @constant

; Invocations
(emit_statement . (identifier) @type)
; Invocations
(emit_statement . (_) @type)
(modifier_invocation (identifier) @function)

(call_expression . (member_expression property: (identifier) @function.method))
(call_expression . (identifier) @function)
(call_expression . (_(member_expression property: (_) @function.method)))
(call_expression . (expression(identifier)) @function)

; Function parameters
(call_struct_argument name: (identifier) @field)
(event_paramater name: (identifier) @variable.parameter)
(call_struct_argument name: (_) @field)
(event_parameter name: (identifier) @parameter)
(parameter name: (identifier) @variable.parameter)

; Yul functions
(yul_function_call function: (yul_identifier) @function)
(yul_function_definition . (yul_identifier) @function (yul_identifier) @variable.parameter)
(yul_function_definition . (yul_identifier) @function (yul_identifier) @parameter)


; Structs and members
(member_expression property: (identifier) @property)
(struct_expression type: ((identifier) @type .))
(struct_expression type: ((expression(identifier)) @type .))
(struct_field_assignment name: (identifier) @property)


Expand Down Expand Up @@ -146,7 +146,7 @@
[
"try"
"catch"
] @keyword.exception
] @exception

[
"return"
Expand All @@ -155,11 +155,11 @@

"function" @keyword.function

"import" @keyword.import
(import_directive "as" @keyword.import)
(import_directive "from" @keyword.import)
"import" @include
(import_directive "as" @include)
(import_directive "from" @include)

(event_paramater "indexed" @keyword)
(event_parameter "indexed" @keyword)

; Punctuation

Expand All @@ -185,7 +185,6 @@
"&&"
"||"
">>"
">>>"
"<<"
"&"
"^"
Expand All @@ -200,7 +199,6 @@
"<="
"=="
"!="
"!=="
">="
">"
"!"
Expand Down
Loading