branch: externals/eglot
commit 65aadca313c07f93c11578520b2740eb52f2ddfd
Author: João Távora <[email protected]>
Commit: João Távora <[email protected]>
Fix #620: simplify eglot--apply-workspace-edit
Suggested by Brian Leung.
* eglot.el (eglot--apply-workspace-edit): simplify
---
eglot.el | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/eglot.el b/eglot.el
index 964658a..f7632cb 100644
--- a/eglot.el
+++ b/eglot.el
@@ -2530,8 +2530,7 @@ is not active."
(eglot--dbind ((VersionedTextDocumentIdentifier) uri
version)
textDocument
(list (eglot--uri-to-path uri) edits version)))
- documentChanges))
- edit)
+ documentChanges)))
(cl-loop for (uri edits) on changes by #'cddr
do (push (list (eglot--uri-to-path uri) edits) prepared))
(if (or confirm
@@ -2541,17 +2540,11 @@ is not active."
(format "[eglot] Server wants to edit:\n %s\n Proceed? "
(mapconcat #'identity (mapcar #'car prepared) "\n
")))
(eglot--error "User cancelled server edit")))
- (while (setq edit (car prepared))
- (pcase-let ((`(,path ,edits ,version) edit))
- (with-current-buffer (find-file-noselect path)
- (eglot--apply-text-edits edits version))
- (pop prepared))
- t)
- (unwind-protect
- (if prepared (eglot--warn "Caution: edits of files %s failed."
- (mapcar #'car prepared))
- (eldoc)
- (eglot--message "Edit successful!"))))))
+ (cl-loop for edit in prepared
+ for (path edits version) = edit
+ do (with-current-buffer (find-file-noselect path)
+ (eglot--apply-text-edits edits version))
+ finally (eldoc) (eglot--message "Edit successful!")))))
(defun eglot-rename (newname)
"Rename the current symbol to NEWNAME."