From ec5c6d31fcf4066746d734e0c2ef859d561614f5 Mon Sep 17 00:00:00 2001 From: "Alexis (Poliorcetics) Bourget" Date: Fri, 28 Oct 2022 21:29:05 +0200 Subject: [PATCH] feat: Categorize Rust's keywords using more specific scopes --- runtime/queries/rust/highlights.scm | 36 +++++++++++++++++++---------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index 81f05f7a3d33a..fb58df8c19140 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -111,23 +111,31 @@ ; ------- (for_expression - "for" @keyword.control) + "for" @keyword.control.repeat) ((identifier) @keyword.control (#match? @keyword.control "^yield$")) + +"in" @keyword.control + +[ + "match" + "if" + "else" +] @keyword.control.conditional + [ "while" "loop" - "in" +] @keyword.control.repeat + +[ "break" "continue" - "match" - "if" - "else" "return" "await" -] @keyword.control +] @keyword.control.return "use" @keyword.control.import (mod_item "mod" @keyword.control.import !body) @@ -143,24 +151,28 @@ "mod" "extern" - "struct" - "enum" "impl" "where" "trait" "for" - "type" - "union" "unsafe" "default" "macro_rules!" - "let" - "async" ] @keyword +[ + "struct" + "enum" + "union" + + "type" +] @keyword.storage.type + +"let" @keyword.local + "fn" @keyword.function (mutable_specifier) @keyword.storage.modifier.mut