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.
This commit is contained in:
Smit Barmase 2025-06-13 12:26:29 +05:30 committed by GitHub
parent 9cc82212b5
commit cb573172a3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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::<ProjectPanel>(cx) {
panel.update(cx, |panel, cx| {
panel.collapse_all_entries(action, window, cx);
});
}
});
})
.detach();
}