Skip to content

Commit

Permalink
Fix & Tweak Rust's Syntax Highlighting (helix-editor#5238)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chickenkeeper authored and hadronized committed Jan 4, 2023
1 parent a960369 commit 38fb6f2
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions runtime/queries/rust/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
"'" @label
(identifier) @label)
(loop_label
(identifier) @type)
"'" @label
(identifier) @label)

; ---
; Punctuation
Expand Down Expand Up @@ -102,8 +103,6 @@
(closure_parameters
(identifier) @variable.parameter)



; -------
; Keywords
; -------
Expand All @@ -129,9 +128,7 @@
[
"break"
"continue"

"return"

"await"
] @keyword.control.return

Expand All @@ -154,24 +151,21 @@
"trait"
"for"

"unsafe"
"default"
"macro_rules!"

"async"
] @keyword

[
"struct"
"enum"
"union"

"type"
] @keyword.storage.type

"let" @keyword.storage

"fn" @keyword.function
"unsafe" @keyword.special
"macro_rules!" @function.macro

(mutable_specifier) @keyword.storage.modifier.mut

Expand Down Expand Up @@ -202,11 +196,11 @@

(call_expression
function: [
((identifier) @type.variant
(#match? @type.variant "^[A-Z]"))
((identifier) @type.enum.variant
(#match? @type.enum.variant "^[A-Z]"))
(scoped_identifier
name: ((identifier) @type.variant
(#match? @type.variant "^[A-Z]")))
name: ((identifier) @type.enum.variant
(#match? @type.enum.variant "^[A-Z]")))
])

; ---
Expand Down Expand Up @@ -237,16 +231,13 @@
((identifier) @type
(#match? @type "^[A-Z]"))



(attribute
(identifier) @_macro
arguments: (token_tree (identifier) @constant.numeric.integer)
(#eq? @_macro "derive")
)
@special


; -------
; Functions
; -------
Expand Down Expand Up @@ -303,8 +294,6 @@
(metavariable) @variable.parameter
(fragment_specifier) @type



; -------
; Operators
; -------
Expand Down Expand Up @@ -350,8 +339,6 @@
"'"
] @operator



; -------
; Paths
; -------
Expand Down Expand Up @@ -382,8 +369,6 @@
(scoped_type_identifier
path: (identifier) @namespace)



; -------
; Remaining Identifiers
; -------
Expand Down

0 comments on commit 38fb6f2

Please sign in to comment.