Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

rust: Highlight enum variants as variant (#47918)

Michael Yang03663b966d0c
diff --git a/crates/languages/src/rust.rs b/crates/languages/src/rust.rs
index 0ac1b8af015..9117da8ad49 100644
--- a/crates/languages/src/rust.rs
+++ b/crates/languages/src/rust.rs
@@ -1807,6 +1807,7 @@ mod tests {
("keyword", Hsla::default()),
("function", Hsla::default()),
("property", Hsla::default()),
+ ("variant", Hsla::default()),
]);
language.set_theme(&theme);
@@ -1814,6 +1815,7 @@ mod tests {
let highlight_function = grammar.highlight_id_for_name("function").unwrap();
let highlight_type = grammar.highlight_id_for_name("type").unwrap();
let highlight_keyword = grammar.highlight_id_for_name("keyword").unwrap();
+ let highlight_variant = grammar.highlight_id_for_name("variant").unwrap();
assert_eq!(
adapter
@@ -1855,7 +1857,7 @@ mod tests {
Some(CodeLabel::new(
"Variant".to_string(),
0..7,
- vec![(0..7, highlight_type)],
+ vec![(0..7, highlight_variant)],
))
);
}
diff --git a/crates/languages/src/rust/highlights.scm b/crates/languages/src/rust/highlights.scm
index 82008d70153..99b9118ba51 100644
--- a/crates/languages/src/rust/highlights.scm
+++ b/crates/languages/src/rust/highlights.scm
@@ -58,7 +58,7 @@
(#match? @constant "^_*[A-Z][A-Z\\d_]*$"))
; Ensure enum variants are highlighted correctly regardless of naming convention
-(enum_variant name: (identifier) @type)
+(enum_variant name: (identifier) @variant)
[
"("