[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 9c5ff71 1/8: Correctly apply workspace edits in d
From: |
João Távora |
Subject: |
[elpa] externals/eglot 9c5ff71 1/8: Correctly apply workspace edits in documentChanges form |
Date: |
Tue, 29 May 2018 22:21:24 -0400 (EDT) |
branch: externals/eglot
commit 9c5ff7161bce6e9c55048c3f1f99e17317c8871f
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Correctly apply workspace edits in documentChanges form
This was breaking M-x eglot-rename for cquery
* eglot.el (eglot--apply-workspace-edit): Fix and simplify.
---
eglot.el | 55 +++++++++++++++++++++++--------------------------------
1 file changed, 23 insertions(+), 32 deletions(-)
diff --git a/eglot.el b/eglot.el
index cd0ee65..fa12577 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1491,39 +1491,30 @@ If SKIP-SIGNATURE, don't try to send
textDocument/signatureHelp."
(defun eglot--apply-workspace-edit (wedit &optional confirm)
"Apply the workspace edit WEDIT. If CONFIRM, ask user first."
- (let (prepared)
- (cl-destructuring-bind (&key changes documentChanges)
- wedit
- (cl-loop
- for change on documentChanges
- do (push (cl-destructuring-bind (&key textDocument edits) change
- (cl-destructuring-bind (&key uri version) textDocument
- (list (eglot--uri-to-path uri) edits version)))
- prepared))
+ (cl-destructuring-bind (&key changes documentChanges) wedit
+ (let ((prepared
+ (mapcar (eglot--lambda (&key textDocument edits)
+ (cl-destructuring-bind (&key uri version) textDocument
+ (list (eglot--uri-to-path uri) edits version)))
+ documentChanges)))
(cl-loop for (uri edits) on changes by #'cddr
- do (push (list (eglot--uri-to-path uri) edits) prepared)))
- (if (or confirm
- (cl-notevery #'find-buffer-visiting
- (mapcar #'car prepared)))
- (unless (y-or-n-p
- (format "[eglot] Server requests to edit %s files.\n %s\n\
-Proceed? "
- (length prepared)
- (mapconcat #'identity
- (mapcar #'car prepared)
- "\n ")))
- (eglot--error "User cancelled server edit")))
- (unwind-protect
- (let (edit)
- (while (setq edit (car prepared))
- (cl-destructuring-bind (path edits &optional version) edit
- (with-current-buffer (find-file-noselect path)
- (eglot--apply-text-edits edits version))
- (pop prepared))))
- (if prepared
- (eglot--warn "Caution: edits of files %s failed."
- (mapcar #'car prepared))
- (eglot--message "Edit successful!")))))
+ do (push (list (eglot--uri-to-path uri) edits) prepared))
+ (if (or confirm
+ (cl-notevery #'find-buffer-visiting
+ (mapcar #'car prepared)))
+ (unless (y-or-n-p
+ (format "[eglot] Server wants to edit:\n %s\n Proceed? "
+ (mapconcat #'identity (mapcar #'car prepared) "\n
")))
+ (eglot--error "User cancelled server edit")))
+ (unwind-protect
+ (let (edit) (while (setq edit (car prepared))
+ (cl-destructuring-bind (path edits &optional version)
edit
+ (with-current-buffer (find-file-noselect path)
+ (eglot--apply-text-edits edits version))
+ (pop prepared))))
+ (if prepared (eglot--warn "Caution: edits of files %s failed."
+ (mapcar #'car prepared))
+ (eglot--message "Edit successful!"))))))
(defun eglot-rename (newname)
"Rename the current symbol to NEWNAME."
- [elpa] externals/eglot updated (796e3c2 -> 4211e0c), João Távora, 2018/05/29
- [elpa] externals/eglot ab8bbdb 2/8: Set eglot--versioned-identifier to 0 on didOpen, João Távora, 2018/05/29
- [elpa] externals/eglot 14c7647 4/8: Be more criterious before running the idle timer, João Távora, 2018/05/29
- [elpa] externals/eglot 9c5ff71 1/8: Correctly apply workspace edits in documentChanges form,
João Távora <=
- [elpa] externals/eglot c2fd78f 3/8: Make eglot--recent-changes a simpler list, João Távora, 2018/05/29
- [elpa] externals/eglot 4416781 5/8: On reconnection, ignore errors of shutting down hung server, João Távora, 2018/05/29
- [elpa] externals/eglot 4211e0c 8/8: * eglot.el (Version): Bump to 0.7, João Távora, 2018/05/29
- [elpa] externals/eglot b97af33 7/8: More yak shaving, João Távora, 2018/05/29
- [elpa] externals/eglot 92c4bdf 6/8: New M-x eglot-stderr-buffer useful for debugging, João Távora, 2018/05/29