godalming123 2025-06-15 17:31:02 +02:00 committed by GitHub
commit ecc8caefd1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

View File

@ -2663,7 +2663,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)));
}

View File

@ -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();

View File

@ -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)]