Allow buffer search in project search (#23819)
Closes #13437 Closes #19993 Release Notes: - Allow searching within the results of a project search - vim: Fix `/`/`?`, `n`/`N`, `gn`/`gN`,`*`/`#` in project search results --------- Co-authored-by: Nico <nico.lehmann@gmail.com>
This commit is contained in:
parent
e1af35aa15
commit
f2b3f3a9ab
10 changed files with 191 additions and 105 deletions
|
@ -42,18 +42,20 @@ pub struct SearchOptions {
|
|||
/// Specifies whether the supports search & replace.
|
||||
pub replacement: bool,
|
||||
pub selection: bool,
|
||||
pub find_in_results: bool,
|
||||
}
|
||||
|
||||
pub trait SearchableItem: Item + EventEmitter<SearchEvent> {
|
||||
type Match: Any + Sync + Send + Clone;
|
||||
|
||||
fn supported_options() -> SearchOptions {
|
||||
fn supported_options(&self) -> SearchOptions {
|
||||
SearchOptions {
|
||||
case: true,
|
||||
word: true,
|
||||
regex: true,
|
||||
replacement: true,
|
||||
selection: true,
|
||||
find_in_results: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,7 +68,7 @@ pub trait SearchableItem: Item + EventEmitter<SearchEvent> {
|
|||
}
|
||||
|
||||
fn has_filtered_search_ranges(&mut self) -> bool {
|
||||
Self::supported_options().selection
|
||||
self.supported_options().selection
|
||||
}
|
||||
|
||||
fn toggle_filtered_search_ranges(
|
||||
|
@ -157,7 +159,7 @@ pub trait SearchableItem: Item + EventEmitter<SearchEvent> {
|
|||
pub trait SearchableItemHandle: ItemHandle {
|
||||
fn downgrade(&self) -> Box<dyn WeakSearchableItemHandle>;
|
||||
fn boxed_clone(&self) -> Box<dyn SearchableItemHandle>;
|
||||
fn supported_options(&self) -> SearchOptions;
|
||||
fn supported_options(&self, cx: &App) -> SearchOptions;
|
||||
fn subscribe_to_search_events(
|
||||
&self,
|
||||
window: &mut Window,
|
||||
|
@ -224,8 +226,8 @@ impl<T: SearchableItem> SearchableItemHandle for Entity<T> {
|
|||
Box::new(self.clone())
|
||||
}
|
||||
|
||||
fn supported_options(&self) -> SearchOptions {
|
||||
T::supported_options()
|
||||
fn supported_options(&self, cx: &App) -> SearchOptions {
|
||||
self.read(cx).supported_options()
|
||||
}
|
||||
|
||||
fn subscribe_to_search_events(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue