project_search: Add button to collapse/expand all excerpts (#41654)

<img width="500" height="834" alt="Screenshot 2025-11-03 at 12  59@2x"
src="https://github.com/user-attachments/assets/15c5e1fc-2291-41b4-9eec-a8cfa5a446c7"
/>

Releases Note:

- Added a button that allows to expand/collapse all project search
excerpts at once.

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
This commit is contained in:
Dylan
2025-11-03 14:50:34 -03:00
committed by GitHub
co-authored by Danilo Leal
parent 45b78482f5
commit 7cfce60570
9 changed files with 125 additions and 8 deletions
+14
View File
@@ -296,6 +296,15 @@ pub trait Item: Focusable + EventEmitter<Self::Event> + Render + Sized {
None
}
/// Returns optional elements to render to the left of the breadcrumb.
fn breadcrumb_prefix(
&self,
_window: &mut Window,
_cx: &mut Context<Self>,
) -> Option<gpui::AnyElement> {
None
}
fn added_to_workspace(
&mut self,
_workspace: &mut Workspace,
@@ -479,6 +488,7 @@ pub trait ItemHandle: 'static + Send {
fn to_searchable_item_handle(&self, cx: &App) -> Option<Box<dyn SearchableItemHandle>>;
fn breadcrumb_location(&self, cx: &App) -> ToolbarItemLocation;
fn breadcrumbs(&self, theme: &Theme, cx: &App) -> Option<Vec<BreadcrumbText>>;
fn breadcrumb_prefix(&self, window: &mut Window, cx: &mut App) -> Option<gpui::AnyElement>;
fn show_toolbar(&self, cx: &App) -> bool;
fn pixel_position_of_cursor(&self, cx: &App) -> Option<Point<Pixels>>;
fn downgrade_item(&self) -> Box<dyn WeakItemHandle>;
@@ -979,6 +989,10 @@ impl<T: Item> ItemHandle for Entity<T> {
self.read(cx).breadcrumbs(theme, cx)
}
fn breadcrumb_prefix(&self, window: &mut Window, cx: &mut App) -> Option<gpui::AnyElement> {
self.update(cx, |item, cx| item.breadcrumb_prefix(window, cx))
}
fn show_toolbar(&self, cx: &App) -> bool {
self.read(cx).show_toolbar()
}