-
Notifications
You must be signed in to change notification settings - Fork 37.5k
Description
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:
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:
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).

