emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/eglot c25c0e3 40/62: Close #64: handle edits to same po


From: Stefan Monnier
Subject: [elpa] externals/eglot c25c0e3 40/62: Close #64: handle edits to same position in the correct order
Date: Sat, 29 Sep 2018 17:13:34 -0400 (EDT)

branch: externals/eglot
commit c25c0e3db707ed7fbf27a8a6b4013789ee2119e6
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    Close #64: handle edits to same position in the correct order
    
    In eglot--apply-text-edits, the markers returned by
    eglot--lsp-position-to-point are of the "stay" type, i.e. have an
    insertion-type of nil.  This causes multiple insertion edits to the
    same location to happen in the reverse order in which they appear in
    the LSP message, which is a violation of the spec and a bug.
    
    There are more ways to solve this (see related discuttion in
    https://github.com/joaotavora/eglot/pull/64), but the easiest way is
    to revert the order in which the edits are processed.  This is because
    the spec tells us that the order is only relevant in precisely this
    "same position" case.  So if we reverse the order we fix this bug and
    don't break anything else.
    
    * eglot.el (eglot--apply-text-edits): Apply edits in reverse..
---
 eglot.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eglot.el b/eglot.el
index eeea104..427fa29 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1555,7 +1555,7 @@ If SKIP-SIGNATURE, don't try to send 
textDocument/signatureHelp."
                       (progress-reporter-update reporter (cl-incf done)))))))
             (mapcar (jsonrpc-lambda (&key range newText)
                       (cons newText (eglot--range-region range 'markers)))
-                    edits))
+                    (reverse edits)))
       (undo-amalgamate-change-group change-group)
       (progress-reporter-done reporter))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]