perf(search): bound the workspace file scan and cache (#74)#78
Merged
Conversation
The findFiles scan passed maxResults=undefined and cached every matching path for the session, so huge workspaces paid unbounded disk I/O up front and held the whole list in memory. - Add relativePath.maxFilesCached (default 100000, 0 = no limit) and pass it as findFiles' maxResults - Track when the scan hit the cap and say so in the picker/input placeholders instead of presenting a silently partial list - Re-scan when the setting changes, like relativePath.ignore Closes #74 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
updateFiles()passedundefinedasfindFiles'maxResults, so the extension scanned and cached every matching path in the workspace for the lifetime of the session. On very large workspaces that meant unbounded disk I/O before the picker could open and hundreds of MB held in_fileNames.This bounds the scan and makes the bound visible:
relativePath.maxFilesCached(default100000,0= no limit, matching the old behavior). It's passed straight through asfindFiles'maxResults, so the cap bounds both the scan time and the cache size.relativePath.ignorealready was.The sanitization and truncation-detection logic lives in a new pure module
src/search-limit.tswith unit tests (test/search-limit.test.ts), following the pattern set byglobs.ts/closest-match.ts.Testing
npm test: 15/15 pass (4 new tests covering default fallback, the0opt-out, flooring, and the cap-reached boundary).tsccompiles cleanly, so thefindFiles(include, exclude, maxResults, token)wiring type-checks against the VS Code API. Not exercised in a live Extension Development Host.Closes #74
🤖 Generated with Claude Code