GNU bug report logs -
#70929
30.0.50; eglot--apply-text-edits prevents point adjustment
Previous Next
Full log
Message #20 received at 70929 <at> debbugs.gnu.org (full text, mbox):
On Tue, May 14, 2024 at 5:28 AM João Távora <joaotavora <at> gmail.com> wrote:
>
> I've reproduced this on the clangd server and c++-ts-mode, but only after
> turning _off_ electric indent-mode, which hides this effect.
Yes, that's correct, electric-indent-mode can hide this.
> > 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.
>
> Doing that naively would lead to chaos. Edits can be supplied to arbitrary
> places in the buffer. Edits can happen in many situations, even when inserting
> completions, for example. If you circumscribe yourself to OnTypeFormatting,
> even Clangd for example performs edits before the full expression that precedes
> the newline. There not even anything forcing the server to provide
> whitespace-only changes.
>
Possibly, although VSCode, which is probably considered the model LSP
client implementation, allows this to happen. Not saying it's
necessarily correct in doing so, just another data point.
> The workaround of enabling electric-indent-mode or just turning off
> OnTypeFormatting
> via eglot-ignored-server-capabilities is much better.
I'm not sure a workaround of turning this off is desirable if you're
trying to use it for indentation. If the mode doesn't have internal
indentation support, this will fallback to something like
indent-relative which might get you in the ballpark but won't be as
accurate as having the language server provide you with the correct
indentation.
I'll bring this to the attention of the Ada Language Server developers.
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.