-
Notifications
You must be signed in to change notification settings - Fork 6
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
Document requirements of FullTextDocument::update() #24
Comments
Stepping back, it seems that this requirement applies to any public API of |
Also, while on the topic of fixing up docstrings, the one for lsp-textdocument/src/text_document.rs Lines 210 to 214 in 7db5a9a
|
Based on microsoft/vscode-languageserver-node#1224, it doesn't sound like the UTF-8 option is coming to VS Code anytime soon... |
I agree with you. The root docstring should remark the Actually, in design that user don't need to care about the update of I think we need support the options I have long time that not care about lsp, lsp-textdocument. In the future, I would like to spend my time to do it. |
I think there is a subtle edge case that should be documented for
FullTextDocument::update()
(which currently has no docstring).Specifically, I believe that each
TextDocumentContentChangeEvent
passed toupdate()
assumes that its associated ranges are specified usingutf-16
as the position encoding (which, as of VS Code 1.81.0, appears to be only position encoding that it supports, though as of version 3.17 of the LSP spec, UTF-8 and UTF-32 are also options an LSP client can offer):https://docs.rs/lsp-types/latest/lsp_types/struct.PositionEncodingKind.html#associatedconstant.UTF16
Because the position encoding is specified up front when the LSP connection is negotiated so that such metadata doesn't have to be sent with every LSP message that references a
Range
orPosition
, the position encoding cannot be determined for an isolatedTextDocumentContentChangeEvent
event.To that end, I think the docs for
update()
should include a disclaimer that it assumes theutf-16
position encoding.Ultimately, it might be nice to support other position encodings, though until VS Code bothers to do so, this does not seem pressing.
The text was updated successfully, but these errors were encountered: