diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 604d69243..22ca00353 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2661,7 +2661,8 @@ fn global_search(cx: &mut Context) { Some((path.as_path().into(), Some((*line_num, *line_num)))) }) .with_history_register(Some(reg)) - .with_dynamic_query(get_files, Some(275)); + .with_dynamic_query(get_files, Some(275)) + .with_language("regex", std::sync::Arc::clone(&cx.editor.syn_loader)); cx.push_layer(Box::new(overlaid(picker))); } diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index 7abdfce84..a6178b392 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -440,6 +440,11 @@ impl Picker { self } + pub fn with_language(mut self, language: &'static str, loader: Arc>) -> Self { + self.prompt.language = Some((language, loader)); + self + } + /// Move the cursor by a number of lines, either down (`Forward`) or up (`Backward`) pub fn move_by(&mut self, amount: u32, direction: Direction) { let len = self.matcher.snapshot().matched_item_count(); diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index ee5c46e76..25d1634f6 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -44,7 +44,7 @@ pub struct Prompt { callback_fn: CallbackFn, pub doc_fn: DocFn, next_char_handler: Option, - language: Option<(&'static str, Arc>)>, + pub language: Option<(&'static str, Arc>)>, } #[derive(Clone, Copy, PartialEq, Eq)]