Searchable base-ref picker in the New Worktree dialog (#387)#411
Searchable base-ref picker in the New Worktree dialog (#387)#411webdevtodayjason wants to merge 2 commits into
Conversation
…pp#387) The base-ref selector was a nested Menu: to branch off feature/jira-1234/core-refactoring you had to remember the jira-1234 prefix and drill local/remote submenus. Replace it with a popover that filters a flat list of local + remote refs as you type, matching any fragment of the full ref (remote, namespace, or leaf) case-insensitively. The filtering lives in pure, tested helpers on BaseRefBranchMenu; the view is a thin renderer and the old nested-menu helper views are removed. Adds BranchMenuFilterTests covering the flatten, deep-fragment match, case-insensitivity, namespace-also-a-branch, and no-match cases.
|
Ideally we'd keep both, because the menu is significantly more practical in larger teams/OSS where you don't necessarily know the name of the repo in advance. |
Per review: the hierarchical menu is the better tool when you don't know the branch name in advance, so keep it. Add an inline filter field beside it that lists matching local + remote refs as rows below as you type — no popover and no keyboard-focus juggling. Filtering still runs through the tested BaseRefBranchMenu.refs(matching:) helper.
|
Love it — yeah, keeping the menu totally makes sense. Browsing is the right move when you don't know the branch name up front, no argument here. 🙌 Just pushed an update that does exactly that: the hierarchical menu stays put for browsing, and there's now an inline filter field right next to it. As you type it drops the matching local + remote refs in as rows right below the field (went with your "set of rows" idea so there's zero keyboard-focus wrestling). Capped it at 8 with a little "keep typing to narrow" nudge so the dialog doesn't blow up. Filtering still runs through the same tested I went rows-first to keep it simple and shippable, but I'm totally down to layer arrow-key nav + the popover route on top next if you wanna get fancy. Lmk what you think! 🚀 |
What
Closes #387. The Base ref selector in the New Worktree dialog was a hierarchical
Menu(Local submenu + per-remote submenus + nested namespace submenus). Finding a deeply-namespaced branch meant remembering its prefix and drilling submenus — e.g. to branch offfeature/jira-1234/core-refactoringyou had to recalljira-1234and whether it was local or remote.Change
Replace the nested menu with a popover that filters a flat list of local + remote refs as you type:
core-refactoringjumps straight tofeature/jira-1234/core-refactoring.baseRefSelectedaction and dismisses.The filtering is implemented as pure helpers on
BaseRefBranchMenu(allRefs()/refs(matching:)), so the view is a thin renderer. The now-unused nested-menu helper views are removed.Tests
BranchMenuFilterTestscovers the flatten, the deep-fragment match (#387's scenario), case-insensitivity across remotes, a namespace segment that's also a branch (release+release/v2), and the no-match case.