Add a Cmd/Ctrl+K command palette that searches everything - #91
Merged
Merged
Conversation
fzf-v1 style subsequence scoring (word-boundary, camelCase and run bonuses, gap penalties) with a file-name-first path variant and a bounded top-K collector. Lives in shared so main (file index) and renderer (commands, refs) rank and highlight identically.
- shared/commands.ts: one list of named app commands (title, shortcut, repo gate). The native menu builds its items from it; the renderer's useAppCommands runs them, for the menu today and the palette next. Open Repository and About now travel as regular menu commands, and the folder/terminal/copy/remote items run through the renderer's existing IPC. - getRefs: every branch and tag (annotated tags peeled) in one for-each-ref. - searchFiles: tracked paths cached per repo in main, keyed to the git index's mtime+size, fuzzy-ranked in yielding chunks so only the best matches cross IPC; a newer query from the same window abandons the older scan.
ContextMenu focuses its first item on open (ring only via :focus-visible), moves with arrows/Home/End, opens and closes submenus with right/left, and can hang from a trigger button. The branch switcher's local/remote/GitHub menu items move into a shared builder so the command palette can offer the same menu; remote rows gain the Checkout their click already performs.
…icon highlightPositions marks fuzzy-match positions (with an offset for showing one slice of a path); acceleratorKeys + <Shortcut> draw a shortcut as one key cap per key (⌘ K, Ctrl Shift F) on the shared .kbd primitive.
One box that searches commands, branches, files, tags, stashes, worktrees, recent repositories and pasted commit ids, in fixed-order sections with "N more" expansion and >, @, / scope prefixes. - Enter reveals: a branch or tag is selected and framed in the Graph (GraphView.revealRequest; a miss clears the session's own filters and retries, commits fall back to History), a changed file opens in Changes, any other file its history, a stash its review. - Tab, right-click or the row's ⋯ open the object's own menu (shared branch/commit/file builders), so acting never needs the reveal. - Files are fuzzy-ranked in main; changed and untracked files merge in from the snapshot. Ranking, scoping and limits are pure and tested. - A quiet Search field with the shortcut in the toolbar for discovery; new delete-tag confirmation for the tag menu.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A Cmd/Ctrl+K command palette: one box that searches commands, branches, files, tags, stashes, worktrees, recent repositories and pasted commit ids. Also reachable from the new Search everything field in the toolbar and View ▸ Search Everything….
>commands,@branches & tags,/files. Sections always appear in the same order and expand with "N more". Every row highlights what matched.How it stays fast on huge repos
main/search/file-index.ts). Thels-fileslist is cached per repo, keyed to the git index's mtime and size, and scanned in yielding chunks. Only the best 50 matches cross IPC, and a newer query from the same window abandons the older scan. Changed and untracked files merge in from the snapshot.for-each-ref, with annotated tags peeled to their commits.shared/fuzzy.ts), so main and the renderer rank identically.Refactors along the way
shared/commands.ts): the native menu builds its items from it, anduseAppCommandsruns them for both the menu and the palette. Open Repository and About now travel as regular menu commands. Reveal in Finder, Open in Terminal, Copy Repository Path and View on Remote now run from the window through the existing IPC calls.:focus-visible) and can hang from a trigger button.common/branchMenuItems.tsx. The switcher's remote-branch menu gains a Checkout item; like clicking a remote row already does, it runsgit checkout origin/fooand leaves HEAD detached (existing behaviour, worth a separate decision).revealRequest/onRevealMissed. A miss clears the session's temporary filters and retries; commits fall back to History.<Shortcut>key-cap component, and a.kbdprimitive.Testing
getRefsandsearchFiles, including cache invalidation and query cancellation.bun run lint,bun run typecheckandbun test(955 tests) pass.🤖 Generated with Claude Code