fix(solidity): variable should not match last, tidy up highlights

This commit is contained in:
Amaan Qureshi 2023-04-25 13:09:18 -04:00
parent 75f911d01f
commit 82bcd8483e

View file

@ -12,6 +12,8 @@
(solidity_version_comparison_operator) @operator (solidity_version_comparison_operator) @operator
(solidity_version) @text.underline @string.special
; Literals ; Literals
[ [
@ -35,8 +37,17 @@
(yul_boolean) @boolean (yul_boolean) @boolean
; Type ; 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 "mapping" @function.builtin)
[ [
@ -55,9 +66,9 @@
; Functions and parameters ; Functions and parameters
(function_definition (function_definition
name: (identifier) @function) name: (identifier) @function)
(modifier_definition (modifier_definition
name: (identifier) @function) name: (identifier) @function)
(yul_evm_builtin) @function.builtin (yul_evm_builtin) @function.builtin
; Use constructor coloring for special functions ; Use constructor coloring for special functions
@ -88,8 +99,8 @@
(struct_field_assignment name: (identifier) @field) (struct_field_assignment name: (identifier) @field)
(enum_value) @constant (enum_value) @constant
; Keywords ; Keywords
[ [
"contract" "contract"
"interface" "interface"
@ -173,7 +184,8 @@
] @include ] @include
(import_directive "as" @include) (import_directive "as" @include)
(import_directive "from" @include) (import_directive "from" @include)
(import_directive "*" @character.special) ((import_directive source: (string) @text.underline)
(#offset! @text.underline 0 1 0 -1))
; Punctuation ; Punctuation
@ -186,21 +198,13 @@
[ [
"." "."
"," ","
":"
; FIXME: update grammar ; FIXME: update grammar
; (semicolon) ; (semicolon)
"->" "->"
"=>" "=>"
] @punctuation.delimiter ] @punctuation.delimiter
(call_struct_argument
":" @punctuation.delimiter)
(slice_access
":" @punctuation.delimiter)
(struct_field_assignment
":" @punctuation.delimiter)
(yul_label
":" @punctuation.delimiter)
; Operators ; Operators
[ [
@ -218,6 +222,7 @@
"/" "/"
"%" "%"
"**" "**"
"="
"<" "<"
"<=" "<="
"==" "=="
@ -234,19 +239,12 @@
":=" ":="
] @operator ] @operator
(yul_assignment
":" @operator
"=" @operator)
[ [
"delete" "delete"
"new" "new"
] @keyword.operator ] @keyword.operator
[ (import_directive "*" @character.special)
(identifier)
(yul_identifier)
] @variable
; Comments ; Comments