-
Notifications
You must be signed in to change notification settings - Fork 200
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
Add new client capability: positionEncodings #916
Conversation
Result in no user-visible changes. Default to codepoint based column calculation, which is the most natural choice for Emacs. * eglot.el (eglot-client-capabilities): Add positionEncodings. (eglot-ignored-server-capabilities): Add positionEncoding. (eglot-negotiated-column, eglot-move-to-negotiated-column): New defuns. (eglot-current-column-function): Change to eglot-negotiated-column. (eglot-move-to-column-function): Change to eglot-move-to-negotiated-column.
I haven't realized but this feature is just a couple of days old. So maybe the PR shouldn't be merged until its final form is crystalized. |
Yep it "has to have" a performance impact, but we don't know how big or small. Would have to be measured, but note that position calculation is likely a hotspot of Eglot. Isn't it possible to check the capability in For users currently overriding Another option is to set the variable's values to |
It seems rust-analyzer and ocaml-lsp now support this LSP feature, although I haven't experimented with them. (I cannot work on this PR at the moment, but wanted to add a note here about the news.) |
I see that utf-32 is advertised by default. Am I correct that that would actually be the most convenient correct version for eglot? That is, that native Emacs offsets which don’t require any transcoding are UTF-32? if that’s the case, I’ll add support for thst to rust-analyzer (IIRC, we support only utf-8 and utf-16, and I was under the impression that utf-8 is EMacs’ native encoding) |
After rust-lang/rust-analyzer#14141, rust-analyzer implements all of utf-8, utf-16 and utf-32, which hopefully should simplify the testing! |
Yes, they are. For example,
That'd be great. However, I'm not sure using utf-32 will result in a better overall performance. The specification has this to say about the issue:
At any rate, we will able to measure the effects of the encoding negotiations. Thank you |
ra PR merged! |
This is closed by commit "Eglot: support positionEncoding LSP capability (bug#61726)": |
This branched off from #915. It doesn't update NEWS.md as there's no user-visible changes. Unfortunately I'm not aware any server that implements this feature, so this is 100% untested. Also it adds another layer of indirection which has to have a small performance impact. The specification doesn't explain the encodings but this is quite informative: https://clangd.llvm.org/extensions.html#utf-8-offsets
Result in no user-visible changes. Default to codepoint based column
calculation, which is the most natural choice for Emacs.
(eglot-ignored-server-capabilities): Add positionEncoding.
(eglot-negotiated-column, eglot-move-to-negotiated-column): New
defuns.
(eglot-current-column-function): Change to
eglot-negotiated-column.
(eglot-move-to-column-function): Change to
eglot-move-to-negotiated-column.