Drop 'override.' prefix from capture names in override query
Co-authored-by: Julia Risley <julia@zed.dev>
This commit is contained in:
parent
2aa7a9e95b
commit
8dcef46842
17 changed files with 35 additions and 36 deletions
|
@ -1421,8 +1421,8 @@ fn test_language_config_at(cx: &mut MutableAppContext) {
|
||||||
)
|
)
|
||||||
.with_override_query(
|
.with_override_query(
|
||||||
r#"
|
r#"
|
||||||
(jsx_element) @override.element
|
(jsx_element) @element
|
||||||
(string) @override.string
|
(string) @string
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
@ -829,10 +829,10 @@ impl Language {
|
||||||
|
|
||||||
let mut values = HashMap::default();
|
let mut values = HashMap::default();
|
||||||
for (ix, name) in query.capture_names().iter().enumerate() {
|
for (ix, name) in query.capture_names().iter().enumerate() {
|
||||||
if let Some(override_name) = name.strip_prefix("override.") {
|
if !name.starts_with('_') {
|
||||||
let value = self.config.overrides.remove(override_name).ok_or_else(|| {
|
let value = self.config.overrides.remove(name).ok_or_else(|| {
|
||||||
anyhow!(
|
anyhow!(
|
||||||
"language {:?} has override in query but not in config: {override_name:?}",
|
"language {:?} has override in query but not in config: {name:?}",
|
||||||
self.config.name
|
self.config.name
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
(comment) @override.comment
|
(comment) @comment
|
||||||
(string_literal) @override.string
|
(string_literal) @string
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
(comment) @override.comment
|
(comment) @comment
|
||||||
(string_literal) @override.string
|
(string_literal) @string
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
(comment) @override.comment
|
(comment) @comment
|
||||||
(string_value) @override.string
|
(string_value) @string
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
(comment) @override.comment
|
(comment) @comment
|
||||||
[(string) (charlist)] @override.string
|
[(string) (charlist)] @string
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
(comment) @override.comment
|
(comment) @comment
|
||||||
[
|
[
|
||||||
(interpreted_string_literal)
|
(interpreted_string_literal)
|
||||||
(raw_string_literal)
|
(raw_string_literal)
|
||||||
(rune_literal)
|
(rune_literal)
|
||||||
] @override.string
|
] @string
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
(comment) @override.comment
|
(comment) @comment
|
||||||
(quoted_attribute_value) @override.string
|
(quoted_attribute_value) @string
|
|
@ -1,9 +1,9 @@
|
||||||
(comment) @override.comment
|
(comment) @comment
|
||||||
(string) @override.string
|
(string) @string
|
||||||
|
|
||||||
[
|
[
|
||||||
(jsx_element)
|
(jsx_element)
|
||||||
(jsx_fragment)
|
(jsx_fragment)
|
||||||
(jsx_self_closing_element)
|
(jsx_self_closing_element)
|
||||||
(jsx_expression)
|
(jsx_expression)
|
||||||
] @override.element
|
] @element
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
(comment) @comment
|
(string) @string
|
||||||
(string) @override.string
|
|
|
@ -1,2 +1,2 @@
|
||||||
(comment) @override.comment
|
(comment) @comment
|
||||||
(string) @override.string
|
(string) @string
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
(comment) @override.comment
|
(comment) @comment
|
||||||
(string) @override.string
|
(string) @string
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
[
|
[
|
||||||
(string_literal)
|
(string_literal)
|
||||||
(raw_string_literal)
|
(raw_string_literal)
|
||||||
] @override.string
|
] @string
|
||||||
[
|
[
|
||||||
(line_comment)
|
(line_comment)
|
||||||
(block_comment)
|
(block_comment)
|
||||||
] @override.comment
|
] @comment
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
(comment)
|
(comment)
|
||||||
(block_comment)
|
(block_comment)
|
||||||
(directive)
|
(directive)
|
||||||
] @override.comment
|
] @comment
|
||||||
(string) @override.string
|
(string) @string
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
(comment) @override.comment
|
(comment) @comment
|
||||||
(string) @override.string
|
(string) @string
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
(jsx_fragment)
|
(jsx_fragment)
|
||||||
(jsx_self_closing_element)
|
(jsx_self_closing_element)
|
||||||
(jsx_expression)
|
(jsx_expression)
|
||||||
] @override.element
|
] @element
|
||||||
(string) @override.string
|
(string) @string
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
(comment) @override.comment
|
(comment) @comment
|
||||||
(string) @override.string
|
(string) @string
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue