Skip to content

Fix cancellation logic in Picker onDidChangeValue handler (fixes #247945) #247946

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

Merged

Conversation

pelmers-db
Copy link
Contributor

@pelmers-db pelmers-db commented May 1, 2025

The onDidChangeValue in the quick access picker has logic to cancel the previous search as the user is typing.

However this logic was never actually called because the value setter on DisposableStore called dispose() on the previous value. The problem is that calling dispose() without cancel() just removes all the listeners without triggering their cancellation handlers. So the dispose(true) runs but it's a no-op; there's nothing left to cancel.

This PR fixes the issue by running the cancellation first, then updating the DisposableStore value.

I observe a 2-10x faster experience when typing in a fairly large workspace, depending on the exact search term.

Resolves #247945

@vs-code-engineering vs-code-engineering bot added this to the May 2025 milestone May 6, 2025
Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find! LGTM

@TylerLeonhardt TylerLeonhardt merged commit fa00def into microsoft:main May 6, 2025
7 checks passed
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Jun 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

File search (cmd-p) extremely slow in large workspaces
4 participants