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:
Conrad Irwin
2025-01-31 00:13:46 -07:00
committed by GitHub
co-authored by Nico
parent e1af35aa15
commit f2b3f3a9ab
10 changed files with 191 additions and 105 deletions
+26 -1
View File
@@ -38,8 +38,11 @@ use text::{BufferId, Selection};
use theme::{Theme, ThemeSettings};
use ui::{h_flex, prelude::*, IconDecorationKind, Label};
use util::{paths::PathExt, ResultExt, TryFutureExt};
use workspace::item::{BreadcrumbText, FollowEvent};
use workspace::item::{Dedup, ItemSettings, SerializableItem, TabContentParams};
use workspace::{
item::{BreadcrumbText, FollowEvent},
searchable::SearchOptions,
};
use workspace::{
item::{FollowableItem, Item, ItemEvent, ProjectItem},
searchable::{Direction, SearchEvent, SearchableItem, SearchableItemHandle},
@@ -1324,6 +1327,28 @@ impl SearchableItem for Editor {
}
}
fn supported_options(&self) -> SearchOptions {
if self.in_project_search {
SearchOptions {
case: true,
word: true,
regex: true,
replacement: false,
selection: false,
find_in_results: true,
}
} else {
SearchOptions {
case: true,
word: true,
regex: true,
replacement: true,
selection: true,
find_in_results: false,
}
}
}
fn query_suggestion(&mut self, window: &mut Window, cx: &mut Context<Self>) -> String {
let setting = EditorSettings::get_global(cx).seed_search_query_from_cursor;
let snapshot = &self.snapshot(window, cx).buffer_snapshot;