From 0dc3753eb2a1af296f5faffaf9c3d29bceb5a37f Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Tue, 25 Jul 2023 14:20:33 -0500 Subject: 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. --- helix-term/src/ui/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'helix-term/src/ui/mod.rs') 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 -- cgit v1.2.3-70-g09d2