From cb573172a3f03419e8fb825e3a30c7cf616eae78 Mon Sep 17 00:00:00 2001 From: Smit Barmase Date: Fri, 13 Jun 2025 12:26:29 +0530 Subject: [PATCH] project_panel: Allow collapse all from workspace context (#32660) Closes #4385 Allow action `project_panel::CollapseAllEntries` to trigger from workspace context without focusing the project panel. Release Notes: - Added a way to collapse all entries in the Project Panel without having to focus it. This can be done by using the `project_panel::CollapseAllEntries` action. --- crates/project_panel/src/project_panel.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 9e7dd9b5e3..4243285e83 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -260,6 +260,14 @@ pub fn init(cx: &mut App) { setting.hide_gitignore = Some(!setting.hide_gitignore.unwrap_or(false)); }) }); + + workspace.register_action(|workspace, action: &CollapseAllEntries, window, cx| { + if let Some(panel) = workspace.panel::(cx) { + panel.update(cx, |panel, cx| { + panel.collapse_all_entries(action, window, cx); + }); + } + }); }) .detach(); }