mirror of https://github.com/helix-editor/helix
Improve solidity highlighting
parent
34c7eb4bd4
commit
4fc0a4dafc
|
@ -1,6 +1,6 @@
|
||||||
; Pragma
|
; Pragma
|
||||||
(pragma_directive) @tag
|
(pragma_directive) @keyword.directive
|
||||||
(solidity_version_comparison_operator _ @tag)
|
(solidity_version_comparison_operator _ @keyword.directive)
|
||||||
|
|
||||||
|
|
||||||
; Literals
|
; Literals
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
[
|
[
|
||||||
(true)
|
(true)
|
||||||
(false)
|
(false)
|
||||||
] @constant.builtin
|
] @constant.builtin.boolean
|
||||||
|
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
|
|
||||||
|
@ -29,7 +29,12 @@
|
||||||
; -----------
|
; -----------
|
||||||
|
|
||||||
(type_name) @type
|
(type_name) @type
|
||||||
(primitive_type) @type
|
|
||||||
|
[
|
||||||
|
(primitive_type)
|
||||||
|
(number_unit)
|
||||||
|
] @type.builtin
|
||||||
|
|
||||||
(user_defined_type (identifier) @type)
|
(user_defined_type (identifier) @type)
|
||||||
(type_alias (identifier) @type)
|
(type_alias (identifier) @type)
|
||||||
|
|
||||||
|
@ -61,6 +66,7 @@
|
||||||
|
|
||||||
; Use constructor coloring for special functions
|
; Use constructor coloring for special functions
|
||||||
(constructor_definition "constructor" @constructor)
|
(constructor_definition "constructor" @constructor)
|
||||||
|
(error_declaration "error" @constructor)
|
||||||
(fallback_receive_definition "receive" @constructor)
|
(fallback_receive_definition "receive" @constructor)
|
||||||
(fallback_receive_definition "fallback" @constructor)
|
(fallback_receive_definition "fallback" @constructor)
|
||||||
|
|
||||||
|
@ -96,7 +102,6 @@
|
||||||
(meta_type_expression "type" @keyword)
|
(meta_type_expression "type" @keyword)
|
||||||
[
|
[
|
||||||
"abstract"
|
"abstract"
|
||||||
"pragma"
|
|
||||||
"contract"
|
"contract"
|
||||||
"interface"
|
"interface"
|
||||||
"library"
|
"library"
|
||||||
|
@ -104,9 +109,9 @@
|
||||||
"struct"
|
"struct"
|
||||||
"enum"
|
"enum"
|
||||||
"event"
|
"event"
|
||||||
"using"
|
|
||||||
"assembly"
|
"assembly"
|
||||||
"emit"
|
"emit"
|
||||||
|
|
||||||
"public"
|
"public"
|
||||||
"internal"
|
"internal"
|
||||||
"private"
|
"private"
|
||||||
|
@ -114,17 +119,22 @@
|
||||||
"pure"
|
"pure"
|
||||||
"view"
|
"view"
|
||||||
"payable"
|
"payable"
|
||||||
|
|
||||||
"modifier"
|
"modifier"
|
||||||
"memory"
|
|
||||||
"storage"
|
|
||||||
"calldata"
|
|
||||||
"var"
|
"var"
|
||||||
"constant"
|
"let"
|
||||||
(virtual)
|
(virtual)
|
||||||
(override_specifier)
|
(override_specifier)
|
||||||
(yul_leave)
|
(yul_leave)
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
||||||
|
[
|
||||||
|
"memory"
|
||||||
|
"storage"
|
||||||
|
"calldata"
|
||||||
|
"constant"
|
||||||
|
] @keyword.storage.modifier
|
||||||
|
|
||||||
[
|
[
|
||||||
"for"
|
"for"
|
||||||
"while"
|
"while"
|
||||||
|
@ -144,6 +154,7 @@
|
||||||
[
|
[
|
||||||
"try"
|
"try"
|
||||||
"catch"
|
"catch"
|
||||||
|
"revert"
|
||||||
] @keyword.control.exception
|
] @keyword.control.exception
|
||||||
|
|
||||||
[
|
[
|
||||||
|
@ -154,6 +165,7 @@
|
||||||
"function" @keyword.function
|
"function" @keyword.function
|
||||||
|
|
||||||
"import" @keyword.control.import
|
"import" @keyword.control.import
|
||||||
|
"using" @keyword.control.import
|
||||||
(import_directive "as" @keyword.control.import)
|
(import_directive "as" @keyword.control.import)
|
||||||
(import_directive "from" @keyword.control.import)
|
(import_directive "from" @keyword.control.import)
|
||||||
(event_parameter "indexed" @keyword)
|
(event_parameter "indexed" @keyword)
|
||||||
|
@ -173,6 +185,9 @@
|
||||||
[
|
[
|
||||||
"."
|
"."
|
||||||
","
|
","
|
||||||
|
":"
|
||||||
|
"->"
|
||||||
|
"=>"
|
||||||
] @punctuation.delimiter
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
|
||||||
|
@ -215,6 +230,7 @@
|
||||||
"new"
|
"new"
|
||||||
] @keyword.operator
|
] @keyword.operator
|
||||||
|
|
||||||
|
; TODO: move to top when order swapped
|
||||||
; identifiers
|
; identifiers
|
||||||
; -----------
|
; -----------
|
||||||
((identifier) @variable.builtin
|
((identifier) @variable.builtin
|
||||||
|
|
Loading…
Reference in New Issue