feat: add top-bar file search with Cmd+P quick open#7
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a VS Code–style “Quick Open” file search to the top bar, backed by new fuzzy-ranking utilities and a global Cmd/Ctrl+P shortcut that focuses the search input.
Changes:
- Introduces
TopBarFileSearchUI with open/workspace sections and ranked fuzzy matching results. - Adds file search scoring/ranking utilities + unit tests.
- Registers
Cmd/Ctrl+Pglobal keybinding and documents the shortcut in the shortcuts drawer + docs/README.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/file-search-utils.test.ts | Adds unit tests covering path splitting and ranking behavior. |
| src/components/ui/index.ts | Re-exports InputGroup* components for shared UI use. |
| src/components/layout/file-search-utils.ts | Implements scoring + ranking for fuzzy file search results. |
| src/components/layout/TopBarUtilityActions.tsx | Removes the old search icon button (replaced by always-visible search). |
| src/components/layout/TopBarFileSearch.tsx | Adds the new top-bar quick-open search UI and dropdown behavior. |
| src/components/layout/TopBar.tsx | Centers the new search input in the top bar layout. |
| src/components/layout/KeyboardShortcutsDrawer.tsx | Adds “Quick open file” shortcut entry and updates footer text. |
| src/components/layout/AppShell.tsx | Adds global Cmd/Ctrl+P handler that focuses/selects the search input. |
| docs/ui/project-workspace-task-shell.md | Documents the new always-visible quick-open search + shortcut. |
| README.md | Mentions the new quick-open behavior in the feature list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export function rankFileSearchResults(args: { files: string[]; query: string; limit?: number }) { | ||
| const normalizedQuery = args.query.trim().toLowerCase(); | ||
| const results: RankedFileSearchResult[] = []; | ||
|
|
||
| for (const filePath of args.files) { | ||
| const score = getFileSearchScore({ filePath, query: normalizedQuery }); | ||
| if (score === null) { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
rankFileSearchResults still computes a score for every file and sorts the full result set even when limit is provided. For large workspaces this can cause noticeable input lag on each keystroke. Consider using limit to keep only the top N results during the scan (e.g., min-heap/partial selection) and only sort those, or short-circuit when the query is empty and you only need alphabetical browsing.
| - The left project list is full-height and reaches the top edge of the app shell. | ||
| - The top bar now applies only to the main work area, not the left project list. | ||
| - The top bar shows the selected workspace path for the current workspace. | ||
| - The top bar exposes an always-visible quick-open file search input, and `Cmd/Ctrl+P` focuses it from anywhere outside text inputs. |
There was a problem hiding this comment.
This doc says Cmd/Ctrl+P focuses the quick-open input from anywhere outside text inputs, but the new Cmd/Ctrl+P handler in AppShell currently runs even when an input/textarea is focused. Please align the documentation with the implemented behavior (or update the shortcut handler if the intent is to ignore text inputs).
| - The top bar exposes an always-visible quick-open file search input, and `Cmd/Ctrl+P` focuses it from anywhere outside text inputs. | |
| - The top bar exposes an always-visible quick-open file search input, and `Cmd/Ctrl+P` focuses it from anywhere in the app. |
| <DrawerFooter className="border-t border-border/70 px-5 py-4 md:flex-row md:items-center md:justify-between md:px-6"> | ||
| <p className="text-sm text-muted-foreground"> | ||
| Task quick jump works on the active task list, and the guide shortcut is ignored while typing in inputs. | ||
| Task quick jump works on the active task list, and the quick open / guide shortcuts are ignored while typing in inputs. |
There was a problem hiding this comment.
The footer states that the “quick open” shortcut is ignored while typing in inputs, but the Cmd/Ctrl+P handler added in AppShell fires regardless of isEditableShortcutTarget(...) (unlike the Cmd+/ guide shortcut). Please update this copy to reflect actual behavior, or adjust the shortcut handler if it should be ignored in inputs.
| Task quick jump works on the active task list, and the quick open / guide shortcuts are ignored while typing in inputs. | |
| Task quick jump works on the active task list, and the guide shortcut is ignored while typing in inputs. |
Summary
Cmd/Ctrl+Pshortcut focuses the search input from anywhere, including inside editorsfocusTokenprop-drilling pattern in favor of direct DOM focus viadata-file-search-inputTest plan
bun testpasses (312 pass, 0 fail)Cmd+Popens and focuses the search bar from chat input, editor, and other contextsEscapeclears query first, then closes dropdown on second press🤖 Generated with Claude Code