From c4263d6a56c6490b34a43c7d393fce321514b6ef Mon Sep 17 00:00:00 2001 From: Chickenkeeper Date: Wed, 21 Dec 2022 23:10:45 +0000 Subject: [PATCH] Fix & Tweak Rust's Syntax Highlighting (#5238) --- runtime/queries/rust/highlights.scm | 31 ++++++++--------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index d3c29270..66058034 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -45,7 +45,8 @@ "'" @label (identifier) @label) (loop_label - (identifier) @type) + "'" @label + (identifier) @label) ; --- ; Punctuation @@ -102,8 +103,6 @@ (closure_parameters (identifier) @variable.parameter) - - ; ------- ; Keywords ; ------- @@ -129,9 +128,7 @@ [ "break" "continue" - "return" - "await" ] @keyword.control.return @@ -154,10 +151,7 @@ "trait" "for" - "unsafe" "default" - "macro_rules!" - "async" ] @keyword @@ -165,13 +159,13 @@ "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 @@ -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]"))) ]) ; --- @@ -237,8 +231,6 @@ ((identifier) @type (#match? @type "^[A-Z]")) - - (attribute (identifier) @_macro arguments: (token_tree (identifier) @constant.numeric.integer) @@ -246,7 +238,6 @@ ) @special - ; ------- ; Functions ; ------- @@ -303,8 +294,6 @@ (metavariable) @variable.parameter (fragment_specifier) @type - - ; ------- ; Operators ; ------- @@ -350,8 +339,6 @@ "'" ] @operator - - ; ------- ; Paths ; ------- @@ -382,8 +369,6 @@ (scoped_type_identifier path: (identifier) @namespace) - - ; ------- ; Remaining Identifiers ; -------