From 3ccc9ecd7e5ffbde31f2ce84c382ac39ef293c6a Mon Sep 17 00:00:00 2001 From: may Date: Thu, 28 May 2026 19:48:33 +0200 Subject: [PATCH] feat(highlights/rust): more exhaustively mark enum variants in match additionally marks the enum variants for struct and tuple struct patterns. and also fix a few other cases, that were previously marked incorrectly: - `namespace::Type` should be `@type`, not `@type.enum.variant` - `Type::CONST` should be `@constant`, not `@type.enum.variant` --- runtime/queries/rust/highlights.scm | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index 9f455e7f..f61c9b79 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -436,9 +436,32 @@ (match_pattern (scoped_identifier - name: ((identifier) @type.enum.variant + path: [(identifier) @type (scoped_identifier name: (identifier) @type)] + name: (identifier) @type.enum.variant + (#match? @type "^[A-Z]") + (#match? @type.enum.variant "^[A-Z]"))) + +(match_pattern + (struct_pattern + type: (scoped_type_identifier + path: [(identifier) @type (scoped_identifier name: (identifier) @type)] + name: (type_identifier) @type.enum.variant + (#match? @type "^[A-Z]") + (#match? @type.enum.variant "^[A-Z]")))) + +(match_pattern + (tuple_struct_pattern + type: (scoped_identifier + path: [(identifier) @type (scoped_identifier name: (identifier) @type)] + name: (identifier) @type.enum.variant + (#match? @type "^[A-Z]") (#match? @type.enum.variant "^[A-Z]")))) +(match_pattern + (scoped_identifier + name: (identifier) @constant + (#match? @constant "^[A-Z_]+$"))) + ; --- ; Macros ; --- -- 2.51.2