-
Notifications
You must be signed in to change notification settings - Fork 3.6k
feat: add support for @ to do file search #1401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
--- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/openai/codex/pull/1400). * #1401 * __->__ #1400
6d4b3ef
to
54af601
Compare
bd92cc3
to
f5fc218
Compare
Currently, this feels good for small repos, but is jarring for large repos because the user cannot type while |
d8c08fe
to
a5d84ca
Compare
dd425f4
to
1c1fe12
Compare
e93781c
to
de04095
Compare
SummaryAdds ReviewGreat UX improvement and the code plugs into existing architecture cleanly. A few small thoughts:
Overall, solid feature—just minor polish opportunities. |
Introduces support for
@
to trigger a fuzzy-filename search in the composer. Under the hood, this leverages https://crates.io/crates/nucleo-matcher to do the fuzzy matching and https://crates.io/crates/ignore to build up the list of file candidates (so that it respects.gitignore
).For simplicity (at least for now), we do not do any caching between searches like VS Code does for its file search:
https://github.com/microsoft/vscode/blob/1d89ed699b2e924d418c856318a3e12bca67ff3a/src/vs/workbench/services/search/node/rawSearchService.ts#L212-L218
Because we do not do any caching, I saw queries take up to three seconds on large repositories with hundreds of thousands of files. To that end, we do not perform searches synchronously on each keystroke, but instead dispatch an event to do the search on a background thread that asynchronously reports back to the UI when the results are available. This is largely handled by the
FileSearchManager
introduced in this PR, which also has logic for debouncing requests so there is at most one search in flight at a time.While we could potentially polish and tune this feature further, it may already be overengineered for how it will be used, in practice, so we can improve things going forward if it turns out that this is not "good enough" in the wild.
Note this feature does not work like
@
in the TypeScript CLI, which was more like directory-based tab completion. In the Rust CLI,@
triggers a full-repo fuzzy-filename search.Fixes #1261.