Catch content modified error#164
Conversation
… waiting for the service-feature-promise to resolve (inside the service-manager), by wrapping the 'await' expressions into a try-catch-block. 'Content-Modifed' errors happen, when the result of a request in execution invalidates, because the internal state changes occured in the mean time. According to the LSP-Spec, these errors can be ignored and shall not be shown in the UI.
|
I would like to handle this in other way. If there is a chance to solve this in client, by re-sending request or throttling it, we should take it. Especially in cases when delta changes caused that one. In other case client and server documents would be incrementally out-of-sync, which is not nice. |
|
That seems to be a bigger change in the code base. Do you have an overview of where to install those changes as I am not yet that familiar with the code base. |
It would be indeed big change, I think I'll tackle it myself. |
|
Just a quick note: I will be offline for the next 2-3 months due to private reasons. Just so you are not wondering when I am not responding. |
|
|
My colleague set it up. He sent me the console command: The version of the lua server is from 24. January 2025 (commitID: 06943cfabb3c8957a15c28ffc0ac7fbc18dfd8f7) I think that the load of the server might be a thing. If the server does not immediately answer the requests due to load, the requests will be outdated. To enforce that, I am typing very fast. Even without autocomplete it needs to update the annotations (for example, if one line is already annotated as error, it needs to update it for every character typed). Hope that helps. |
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.