From db18f7a2b008452a5c64a87735ed9cdd916ebcbd Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Tue, 17 Sep 2024 18:32:22 -0400 Subject: [PATCH] rust: Fix doc comment highlighting (#17976) This PR fixes an issue where `/` and `!` in Rust doc comments were being incorrectly highlighted as operators after #17734. We solve this by removing them from the operators list and using more scoped queries to highlight them. Release Notes: - N/A --------- Co-authored-by: Max --- crates/languages/src/rust/highlights.scm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/languages/src/rust/highlights.scm b/crates/languages/src/rust/highlights.scm index 0c3aa7efc7a2a54343ec26d11ec197e8ed7a1830..8d4bad06e06ea90569963a3a6f17251b4de05cb4 100644 --- a/crates/languages/src/rust/highlights.scm +++ b/crates/languages/src/rust/highlights.scm @@ -139,7 +139,6 @@ ] @comment.doc [ - "!" "!=" "%" "%=" @@ -159,7 +158,6 @@ ".." "..=" "..." - "/" "/=" ":" ";" @@ -183,6 +181,10 @@ "?" ] @operator +; Avoid highlighting these as operators when used in doc comments. +(unary_expression "!" @operator) +operator: "/" @operator + (lifetime) @lifetime (parameter (identifier) @variable.parameter)