Catch content modified error #164
Open
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.
Hi,
I was having a look into the "Content-Modified" error, that I got, when doing the other pull request (#161). The error also appeared when not using those code changes.
The LSP-Spec says, that the Content-Modified-Error appears, when the server is executing a request and the editor state changes, which in my understanding happens, when typing quite fast and the server is not keeping pace with the request executions (https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#implementationConsiderations):
So I tracked down the position where the error is thrown, which is inside the service-manager, which is awaiting the Promise that is returned by the service-feature (in that case the language-client). That promise is rejected in case of the Content-Modified-Error, so the 'await' expression is throwing the error.
For every message-type, that is awaiting a promise I simply put a try-catch around the code, that is catching the error, which is ignored, if it is the "Content-Modified" error.