Skip to content

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

Merged
TylerLeonhardt merged 1 commit into
microsoft:mainfrom
pelmers-db:pelmers-db/letsfixslowsearch
May 6, 2025
Merged

Fix cancellation logic in Picker onDidChangeValue handler (fixes #247945)#247946
TylerLeonhardt merged 1 commit into
microsoft:mainfrom
pelmers-db:pelmers-db/letsfixslowsearch

Conversation

@pelmers-db

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

Copy link
Copy Markdown
Contributor

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

@TylerLeonhardt TylerLeonhardt left a comment

Copy link
Copy Markdown
Member

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
@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

4 participants