Tune regex highlights for usage in prompts
Since regex is almost always injected into other languages,
`pattern_character`s will inherit the highlight for the structure that
injects them (for example `/foo/` in JavaScript or `~r/foo/` in Elixir).
This removes the string highlight when used in the prompt.
We also add `ERROR` node highlighting so that errors in regex syntax
appear in the prompt. This resolves a TODO in the `regex_prompt`
function about highlighting errors in the regex.
commitf0b877e2588306882f71eaad45a3f3e604885a34
authorMichael Davis <mcarsondavis@gmail.com>
dateTue 25 Jul 2023, 16:11 (3 years ago)
parent0dc3753
helix-term/src/ui/mod.rs−3
@@ -142,9 +142,6 @@ pub fn regex_prompt(
142142 };
143143
144144 cx.jobs.callback(callback);
145− } else {
146− // Update
147− // TODO: mark command line as error
148145 }
149146 }
150147 }
runtime/queries/regex/highlights.scm+1−1
@@ -50,4 +50,4 @@
5050 ])
5151
5252(class_character) @constant.character
53−(pattern_character) @string
53+(ERROR) @error