Add `ExpandAllEntries` action, keybinding, and right-click context menu entries for expand/collapse all in the project panel. - Add `ExpandAllEntries` action + handler + `expand_all_entries()` method - Add `cmd-right` / `ctrl-right` keybinding for `ExpandAllEntries`, mirroring the existing `cmd-left` for `CollapseAllEntries` - Add "Expand All" to root-entry and folder right-click context menus - Add keybinding hint to root-entry "Collapse All" context menu entry - Per-worktree behavior: context menu actions affect only the selected worktree, subfolder "Expand All" expands from that folder down # Objective The project panel had no discoverable way to expand or collapse all entries. The only ways were keyboard shortcuts (`cmd-left` for collapse all) or the right-click context menu. The global `ExpandAllEntries` shortcut (`cmd-right`) was also missing. This PR adds that shortcut and exposes both actions in the context menu so users learn the keybindings while keeping the UI minimal. ## Solution - Add `ExpandAllEntries` action + handler + `expand_all_entries()` method - Add `cmd-right` / `ctrl-right` keybinding for `ExpandAllEntries` (global), mirroring the existing `cmd-left` for `CollapseAllEntries` - Add "Expand All" to the right-click context menu for both root entries and subfolder entries - Update root-entry "Collapse All" to show its keybinding hint via `.action(Box::new(CollapseAllEntries))` - **Per-worktree behavior**: each root entry's context menu actions affect only that worktree, subfolder "Expand All" expands from that folder down ## Testing - Added 6 GPUI tests in `project_panel_tests.rs`: - `test_expand_all_entries`: single worktree - `test_expand_all_entries_multiple_worktrees`: global expand across worktrees - `test_expand_all_entries_via_window_dispatch`: action dispatch path - `test_per_worktree_expand`: expand only the clicked worktree - `test_per_worktree_collapse`: collapse only the clicked worktree, keep root visible - `test_expand_all_entries_with_auto_fold`: expand with auto_fold_dirs - Ran `cargo test -p project_panel`: 106 pass **Manual testing for reviewers:** 1. Open a project with nested directories and open the Project Panel 2. Right-click a root entry, confirm "Expand All" and "Collapse All" appear with their keybinding hints (`⌘→` / `⌘←`) 3. Right-click a subfolder, confirm "Expand All" and "Collapse All" appear 4. Click "Expand All" on a subfolder, confirm only that folder's subtree expands 5. Click "Collapse All", confirm children collapse but the root stays visible 6. Open a multi-folder workspace. Right-click the second root and click "Expand All", confirm only that folder expands 7. Press `cmd-right` (or `ctrl-right`), confirm all worktrees expand globally Tested on macOS only. Linux and Windows should behave the same since there is no platform-specific code. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable ## Showcase https://github.com/user-attachments/assets/adc501d7-8e3a-4687-aef0-dc00426d232d --- Release Notes: - Added `Expand All` and `Collapse All` to the project panel right-click context menu with keybinding hints. - Added `cmd-right` / `ctrl-right` keybinding to expand all entries. --------- Co-authored-by: Danilo Leal <daniloleal09@gmail.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6 files changedLine totals unavailable