feat(desktop): ⌘⇧E collapses / expands all sidebar projects - #89487
leighton-tidwell wants to merge 2 commits into
Conversation
No blocking issues found.
|
70c8fff to
dabd151
Compare
Rebased onto current Valid, fixed — This one was a real bug, so I checked it rather than assuming the fallback covered it.
Enumerating Chinese users would have seen the literal string Design decision — deferring the hardcoded label to the author The Verification (worktree on |
dabd151 to
4130c46
Compare
4130c46 to
99658ba
Compare
99658ba to
15a0d96
Compare
15a0d96 to
e5ec889
Compare
82f88d5 to
b7817ee
Compare
b7817ee to
937f5e1
Compare
937f5e1 to
9bc193d
Compare
7a20c1c to
21eb102
Compare
21eb102 to
b6af47e
Compare
b6af47e to
3677b1f
Compare
596c1c0 to
e1f717e
Compare
e1f717e to
529730f
Compare
529730f to
50d7dac
Compare
50d7dac to
4691d30
Compare
4691d30 to
8014a50
Compare
8014a50 to
9834a1a
Compare
056ed55 to
17c2575
Compare
17c2575 to
35668c4
Compare
35668c4 to
01395d4
Compare
bd43247 to
2738a29
Compare
2738a29 to
6d9d0c0
Compare
6d9d0c0 to
a5817b2
Compare
The sidebar's "Collapse all" / "Expand all" was mouse-only: open the filter menu, then click the row. With more projects than fit on screen that's the one action you want most often and the slowest one to reach. Bind it to ⌘⇧E — the explorer mnemonic (VS Code's ⌘⇧E focuses the explorer tree), and an unclaimed chord here; a test asserts no other action ships the same default, since a duplicate would read as a permanent conflict in the keybinds panel and make one of the two unreachable. The toggle itself moves into `toggleAllProjectsCollapsed` in the projects store so the menu row and the hotkey run the same code rather than drifting. It keeps the menu's existing rules: only the project rows fold (Pinned and Cron are not what "collapse all" means here), their lanes underneath keep their own state, and it is a no-op under a grouping that puts no project rows on screen — so the key can't write state the user cannot see. The menu row now renders the live keybind hint beside it, so the shortcut is discoverable from the place people already use, and it tracks a rebind instead of hardcoding ⌘⇧E.
Review nit on NousResearch#89487: `view.toggleProjects` shipped an English label in `en.ts` only, and the shortcuts panel resolves labels through `k.actions[action.id] ?? action.id`. Locales built with `defineLocale` merge over `en`, so ar, ja and zh-hant inherited the English string. `zh.ts` is a full `Translations` literal rather than a `defineLocale` call, so it inherited nothing and the panel rendered the raw id `view.toggleProjects` to Chinese users. The `actions` map is typed `Record<string, string>`, so the missing key was invisible to `tsc`. Add the zh string, and cover every shipped locale with a contract test that asserts the label resolves to real text rather than the action id — which is the failure a future locale would reproduce.
What
Binds the sidebar's Collapse all / Expand all to ⌘⇧E (Ctrl+Shift+E off macOS), and surfaces the hint on the menu row that already runs it.
Today that action is mouse-only: open the filter menu, then click the row. With more projects than fit on screen it's the action you reach for most often and the slowest one to get to.
The chord
⌘⇧E is the explorer mnemonic — VS Code's ⌘⇧E focuses the explorer tree — and it was unclaimed in
KEYBIND_ACTIONS. A test asserts nothing else ships the same default, since a duplicate would read as a permanent conflict in the keybinds panel and make one of the two actions unreachable.It's a normal rebindable action: it appears in the shortcuts panel under View, and the menu hint reads from
useKeybindHintso a rebind is reflected there rather than hardcoding ⌘⇧E.Shape
The toggle moves into
toggleAllProjectsCollapsedin the projects store, so the menu row and the hotkey run the same code instead of drifting. It keeps every rule the menu already had:No new core tool, no new env var, no new config surface — one row in the existing keybind registry, one handler, one shared store function.
Proof
Real running desktop (
npm run dev, driven over CDP), not a mock.The menu row with its live hint:
Before ⌘⇧E / after ⌘⇧E — and pressing it again restored the expanded state:
Tests
Behavior contracts, not snapshots —
store/projects.test.tscovers collapse, expand-back, nested lanes surviving the fold, and the non-project-grouping no-op;lib/keybinds/actions.test.tscovers registration, the English label, and the no-collision invariant.Related open PRs
I checked for duplicates before opening this: no issue requests it, and no PR (open, merged, or closed) implements a collapse/expand shortcut. Three open PRs touch
filter-menu.tsx, none overlapping in purpose — #86196 (saved sidebar views) and #88123 (manual session ordering) are independent.One merge-order note: #85952 (i18n for the filter menu) edits the same line this PR does, swapping the literals for
f.expandAll/f.collapseAll. The changes are complementary — that PR localizes the label, this one appends a shortcut hint beside it — but whichever merges second takes a one-line conflict. Resolution is to keep their localized label AND the<DropdownMenuShortcut>sibling:Happy to rebase onto whichever lands first.