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.

go: Fix highlighting of fields (#37026)

Kai Ren4b0609840b6b
diff --git a/crates/languages/src/go.rs b/crates/languages/src/go.rs
index 24e2ca2f56f..86f8e1faaa9 100644
--- a/crates/languages/src/go.rs
+++ b/crates/languages/src/go.rs
@@ -764,6 +764,7 @@ mod tests {
let highlight_type = grammar.highlight_id_for_name("type").unwrap();
let highlight_keyword = grammar.highlight_id_for_name("keyword").unwrap();
let highlight_number = grammar.highlight_id_for_name("number").unwrap();
+ let highlight_field = grammar.highlight_id_for_name("property").unwrap();
assert_eq!(
adapter
@@ -828,7 +829,7 @@ mod tests {
Some(CodeLabel {
text: "two.Three a.Bcd".to_string(),
filter_range: 0..9,
- runs: vec![(12..15, highlight_type)],
+ runs: vec![(4..9, highlight_field), (12..15, highlight_type)],
})
);
}
diff --git a/crates/languages/src/go/highlights.scm b/crates/languages/src/go/highlights.scm
index 5aa23fca90b..bb0eaab88a1 100644
--- a/crates/languages/src/go/highlights.scm
+++ b/crates/languages/src/go/highlights.scm
@@ -1,13 +1,13 @@
(identifier) @variable
(type_identifier) @type
-(field_identifier) @variable.member
+(field_identifier) @property
(package_identifier) @namespace
(keyed_element
.
(literal_element
- (identifier) @variable.member))
+ (identifier) @property))
(call_expression
function: (identifier) @function)