diff options
| author | João Távora | 2023-09-01 00:48:25 +0100 |
|---|---|---|
| committer | João Távora | 2023-09-01 01:00:19 +0100 |
| commit | ed5ccf9da227d0a9f22ce45eff6382feb8979912 (patch) | |
| tree | 9b52f771b31f012fcf163e85fd4e0b7940014755 /doc | |
| parent | fad48a20e665e6b5b51c417e9c04946517a2aa2f (diff) | |
| download | emacs-ed5ccf9da227d0a9f22ce45eff6382feb8979912.tar.gz emacs-ed5ccf9da227d0a9f22ce45eff6382feb8979912.zip | |
Eglot: revamp confirmation model for server-proposed edits
bug#60338
The variable 'eglot-confirm-server-edits' replaces the obsolete
'eglot-confirm-server-initiated-edits' and brings about a new
confirmation model, making it possible to have only certain commands
require user confirmation. This was achieved careful usage of the
'this-command' and 'last-command' variables.
There are now two types of confirmation: the usual
minibuffer summary and a temporary 'diff-mode' buffer to display the
proposed changes, so the user can apply them one by one.
Thanks to Philip Kaludercic for the diff-mode idea and implementation.
Co-authored-by: Philip Kaludercic <philipk@posteo.net>
* doc/misc/eglot.texi (Eglot Variables): Describe
'eglot-confirm-server-edits'.
* etc/EGLOT-NEWS (latest): Mention change.
* lisp/progmodes/eglot.el (diff-mode): Require it.
(eglot-confirm-server-initiated-edits): Obsolete it.
(eglot-confirm-server-edits): New variable.
(eglot-handle-request workspace/applyEdit): Use 'last-command'
(eglot-execute t t): Use 'this-command'.
(eglot--apply-workspace-edit): Rework.
(eglot-rename): Use 'this-command'.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/misc/eglot.texi | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi index 6eb212ca841..3338756c63c 100644 --- a/doc/misc/eglot.texi +++ b/doc/misc/eglot.texi | |||
| @@ -831,12 +831,14 @@ last buffer managed by it is killed. @xref{Shutting Down LSP Servers}. | |||
| 831 | The default is @code{nil}; if you want to shut down a server, use | 831 | The default is @code{nil}; if you want to shut down a server, use |
| 832 | @kbd{M-x eglot-shutdown} (@pxref{Eglot Commands}). | 832 | @kbd{M-x eglot-shutdown} (@pxref{Eglot Commands}). |
| 833 | 833 | ||
| 834 | @item eglot-confirm-server-initiated-edits | 834 | @item eglot-confirm-server-edits |
| 835 | Various Eglot commands and code actions result in the language server | 835 | Various Eglot commands and code actions result in the language server |
| 836 | sending editing commands to Emacs. If this option's value is | 836 | sending editing commands to Emacs. If this option's value is |
| 837 | non-@code{nil} (the default), Eglot will ask for confirmation before | 837 | non-@code{nil}, Eglot will ask for confirmation before performing |
| 838 | performing edits initiated by the server or edits whose scope affects | 838 | edits proposed by the language server. This option's value can be |
| 839 | buffers other than the one where the user initiated the request. | 839 | crafted to require this confirmation for specific commands or only |
| 840 | when the edit affects files not yet visited by the user. Consult this | ||
| 841 | option's docstring for more information. | ||
| 840 | 842 | ||
| 841 | @item eglot-ignored-server-capabilities | 843 | @item eglot-ignored-server-capabilities |
| 842 | This variable's value is a list of language server capabilities that | 844 | This variable's value is a list of language server capabilities that |