Stop running cancel request in the main thread #3028
Merged
+1
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This PR is another temporary solution for #3019. It reverts the other part of #2939.
Implementation
Essentially, we go back to pushing
$/cancelRequest
notifications to our incoming queue, rather than executing it straight away in the main thread.This behaviour is incorrect because it essentially means no request will ever be cancelled. The order of operations is:
There's no way this sequence of operations is correct, but for whatever reason reverting back to this fixes the LSP in NeoVim.
There are clearly things I'm not understanding about request cancellation and what editor/server are expected to do, so I will need to dig deeper to understand the underlying issue and how to properly implement it.
Note
The consequence of reverting back to the old behaviour is performance. Executing a request for which cancellation happened makes the server waste time generating a response that the editor is going to ignore anyway.