diff options
author | Michael Davis | 2023-07-25 19:20:33 +0000 |
---|---|---|
committer | Blaž Hrastnik | 2023-07-27 02:50:19 +0000 |
commit | 0dc3753eb2a1af296f5faffaf9c3d29bceb5a37f (patch) | |
tree | d3e1a3cff12864b4b51a142c5a88e1a4d0c7e927 /helix-term/src/ui/mod.rs | |
parent | 6a431afc4e650efd2eca4afdf1122b3896e43ee3 (diff) |
Syntax-highlight regex prompts
We can use tree-sitter-regex highlighting in prompts for entering
regexes, like `search` or `global_search`. The `highlighted_code_block`
function from the markdown component makes this a very small change.
This could be improved in the future by leaving the parsed syntax tree
on the prompt, allowing incremental updates. Prompt lines are usually so
short though and tree-sitter-regex is rather small and uncomplicated,
so that improvement probably wouldn't make a big difference.
Diffstat (limited to 'helix-term/src/ui/mod.rs')
-rw-r--r-- | helix-term/src/ui/mod.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index 3359155d..8ca1b131 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -151,7 +151,8 @@ pub fn regex_prompt( } } }, - ); + ) + .with_language("regex", std::sync::Arc::clone(&cx.editor.syn_loader)); // Calculate initial completion prompt.recalculate_completion(cx.editor); // prompt |