From d2fa0e7f007570d35f849e291879d22aee713fa7 Mon Sep 17 00:00:00 2001 From: Rock Boynton Date: Sun, 19 Jan 2025 12:52:41 -0800 Subject: [PATCH 1/3] Update `tree-sitter-rust` The catalyst for this was that I was updating my code to use the `raw` references added in Rust version 1.82 and saw they weren't being highlighted properly. This bumps `tree-sitter-rust` to the master branch, which is just one (seemingly bugfix) commit ahead of their 0.23.2 release. --- languages.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages.toml b/languages.toml index a99516db4cb6..a71b1be6aa4f 100644 --- a/languages.toml +++ b/languages.toml @@ -296,7 +296,7 @@ args = { attachCommands = [ "platform select remote-gdb-server", "platform conne [[grammar]] name = "rust" -source = { git = "https://github.com/tree-sitter/tree-sitter-rust", rev = "9c84af007b0f144954adb26b3f336495cbb320a7" } +source = { git = "https://github.com/tree-sitter/tree-sitter-rust", rev = "1f63b33efee17e833e0ea29266dd3d713e27e321" } [[language]] name = "sway" From 6a997b49ab031b3b073c701744e585c871de351e Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 23 Jan 2025 14:00:49 -0500 Subject: [PATCH 2/3] rust: Highlight `use<..>` and `raw` keywords from v1.82.0 --- runtime/queries/rust/highlights.scm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index 898bde6a342c..f56bec175e66 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -204,6 +204,10 @@ (type_cast_expression "as" @keyword.operator) +((generic_type + type: (type_identifier) @keyword) + (#eq? @keyword "use")) + [ (crate) (super) @@ -241,6 +245,7 @@ [ "static" "const" + "raw" "ref" "move" "dyn" From 6f1849b574dc928d7553dde0c3d67ca6e2bdbc6d Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Thu, 23 Jan 2025 14:09:33 -0500 Subject: [PATCH 3/3] rust: Highlight `gen` and `yield` These are also supported by the newer version of the parser. --- runtime/queries/rust/highlights.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index f56bec175e66..89449202e704 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -174,8 +174,7 @@ (for_expression "for" @keyword.control.repeat) -((identifier) @keyword.control - (#match? @keyword.control "^yield$")) +(gen_block "gen" @keyword.control) "in" @keyword.control @@ -196,6 +195,7 @@ "continue" "return" "await" + "yield" ] @keyword.control.return "use" @keyword.control.import