Subject: Re: bug#60338: [PATCH] Add option to present server changes as diffs

From: Philip Kaludercic <[email-masked]>
Date: Fri, 09 Jun 2023 07:55:49 +0000

(Sorry for the delay in answering, I forgot about this thread)

Felician Nemeth <[email-masked]> writes:

> This is going to be a bit off-topic, but I'm guessing that users (after
> a while) get used to what they can expect from a specific language
> server when it comes to code-actions.  And with a well written server,
> users should never want to partially apply a server initiated text-edit.
>
> Therefore it might be a better UI to apply every text-edit without
> questions, display a message when the changes are not visible ("Changed
> 100 lines in 10 files"), provide a command to view the last text-edit as
> a diff, and allow the users to undo the change with a single undo
> command.
>
> This UI wouldn't slow down experienced users, and it would allow them to
> quickly correct rare mistakes.  Eglot could also teach inexperienced
> users with messages like "Changed 2 lines in 1 file.  `undo-view-last'
> shows the change."
>
> WDT?

In principle this should be ok, but there are users who for whatever
reason do not want the language server to modify the files (e.g.
because they don't like it in principle, or because the language is
/not/ well written).  I tend towards that camp, and which is why I wrote
the patch in the first place.

The other issue is that the patch would have to be generated before any
changes are applied, so that the user can inspect it after the server
made the changes, regardless of whether or not they will be interested
or not.  I am not sure how much waste this will generate, and if it is
really worth it, compared to having a diff as a "prompt".