mirror of https://github.com/helix-editor/helix
Add grep syntax highlighting to global search picker
parent
2baff46b25
commit
669174c7d1
|
@ -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)));
|
||||
}
|
||||
|
|
|
@ -440,6 +440,11 @@ impl<T: 'static + Send + Sync, D: 'static + Send + Sync> Picker<T, D> {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn with_language(mut self, language: &'static str, loader: Arc<ArcSwap<Loader>>) -> 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();
|
||||
|
|
|
@ -44,7 +44,7 @@ pub struct Prompt {
|
|||
callback_fn: CallbackFn,
|
||||
pub doc_fn: DocFn,
|
||||
next_char_handler: Option<PromptCharHandler>,
|
||||
language: Option<(&'static str, Arc<ArcSwap<syntax::Loader>>)>,
|
||||
pub language: Option<(&'static str, Arc<ArcSwap<syntax::Loader>>)>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
|
|
Loading…
Reference in New Issue