Skip to content

CompletionList.isIncomplete=true results in showing "stale" results when typing quickly due to cancelled requests #147830

@DanTup

Description

@DanTup

I'm trying to move my extension to using isIncomplete=true on Completion results to avoid preloading thousands of items in the first request. However, when I do this, the completion feels sluggish/doesn't update and I suspect it's due to how cancellations are handled.

I made a small completion provider that takes 40ms to return, and a test that types one character every 60ms (this means all requests complete without any cancellation). I include the offset of the request in the results to make it clear when updated results are shown. As expected, the completion list updates on every keystroke:

Apr-21-2022 09-51-20

However, if I increase the completion provider to take 80ms to return (slightly longer than the delay between keystrokes), the completion list doesn't update at all until the typing stops:

Apr-21-2022 09-52-14

My understanding is that when you type a new character, VS Code cancels the previous (in-flight) request and sends a new one. This makes sense. However, if the server returns the results anyway (perhaps it had already computed them), I think it would be a much better experience if VS Code still used those results while waiting for the next one. Otherwise, using isIncomplete=true results in completion feeling sluggish when typing slightly faster than the server is responding (server response times may increase slightly if lots of requests are being sent/cancelled, as there could be synchronous work that means they don't immediately handle the cancellation).

Metadata

Metadata

Assignees

Labels

suggestIntelliSense, Auto Completeunder-discussionIssue is under discussion for relevance, priority, approach

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions