-
Notifications
You must be signed in to change notification settings - Fork 799
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
textDocument/didChange version number reaches maximum value #2053
Comments
LSP uses JSONRPC and there doesn't seem to be any limitation on the integer size in the JSONRPC or JSON specs: https://stackoverflow.com/questions/13502398/json-integers-limit-on-size So in practice it could still be limited on the implementation language of clients and servers. For example Python has also no limits on integer size, but if we take JavaScript, then it looks like the limit is Number.MAX_SAFE_INTEGER which is Edit: Actually I see now that the |
That is not a specified requirement. It may start at 1 billion and increase by billion or any number. |
What would be the actual use case why a client would do this? My reasoning as a client maintainer/contributer is, that requiring the version number to reset to 0 when the maximum is reached would be kind of a breaking change which every client and every server would need to implement in order to be fully spec compliant. I don't want to implement that if there is no practical relevance for it. So I would propose to just leave this as "undefined behavior", or if this theoretical case should really be considered in the specs, then rather add a sentence like "Please restart your editor every 100 years to ensure that the document synchronisation works correctly" or so... |
I agree with @jwortmann comments. What we can do is to add a sentence to the spec to start when possible with a low number and that there are no means to wrap since the assumption is that editors don't run for so long. |
Out of interest, are version numbers reusable after closing/re-opening a doc? (it doesn't seem obvious from the spec, but maybe that should be noted too). |
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#versionedTextDocumentIdentifier
What happens when the version number reaches the
number.max
value, and there are still changes?At that point, server won't see new changes as version can't increase anymore. (It may sound like an edge case, but shouldn't specification address edge cases?).
After reaching the max value, I propose resetting the version counter to 0.
The text was updated successfully, but these errors were encountered: