Make search execution asynchronous
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
#7495 changed the search system to use a timeout (1 second) rather than a cap on the number of matches (1000). This is an improvement for most use-cases but it's still a crappy experience when searching in a large-ish file, since it takes 1 second for each character you type, if there are enough matches.
The solution to this, of course, is to do no real searching within the usual handleKeyEvent callback. If there's an active search for which we haven't scanned the whole document, spawn a task to do that (and populate SearchState.matchRanges or similar), stopping after X millis to spawn an identical task and unblock.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the search flow around the handleKeyEvent callback and the SearchState.matchRanges state, then review issue #7495 for the current timeout behavior. The change is complete when handleKeyEvent no longer performs the full search synchronously, background tasks incrementally populate match ranges, and each task yields after the specified time limit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- performance, search
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100