GNU bug report logs -
#70929
30.0.50; eglot--apply-text-edits prevents point adjustment
Previous Next
Full log
View this message in rfc822 format
Troy Brown <brownts <at> troybrown.dev> writes:
> Language Servers may use onTypeFormatting to provide indentation for a
> buffer. When this happens, the language server will indicate a
> newline trigger character (in the DocumentOnTypeFormattingOptions).
> In the Emacs buffer, after hitting RET, point is moved to the next
> line and a textDocument/onTypeFormatting request is sent from Eglot to
> the server. The server responds back with the corresponding spacing
> prefix for the line in newText of the TextEdit response. However,
> when Eglot applies the text edit to insert this spacing, via
> eglot--apply-text-edits, it uses save-excursion, and this prevents the
> point from being pushed to the end of the inserted spacing. It would
> seem that save-excursion should be avoided when applying text edits.
> This issue has been observed with the Ada Language Server.
If I remember correctly, the LSP specification does not say where the
point should be after onTypeFormatting. Something like this motivated
the rust-analyzer developers to introduce their own SnippetTextEdit
extension. The upcoming LSP version is going to contain a slightly
different version of the SnippetTextEdit.
If my memories are correct, Ada Language Server should use this
SnippetTextEdit to unambiguously communicate its intent here. (However,
Eglot does not currently supports SnippetTextEdit.)
This bug report was last modified 1 year and 27 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.