]> git.eshelyaron.com Git - emacs.git/commitdiff
Apply any additionaltextedits unconditionally
authorJoão Távora <joaotavora@gmail.com>
Fri, 24 Jun 2022 09:35:07 +0000 (10:35 +0100)
committerJoão Távora <joaotavora@gmail.com>
Thu, 7 Jul 2022 11:32:32 +0000 (12:32 +0100)
* eglot.el (eglot-completion-at-point): Apply any
additionalTextEdits unconditionally.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/981

lisp/progmodes/eglot.el

index b058183fb9646e6c031577be8eb98d299ce68b3a..eb5b86ed10bd0d15e3c7edab90392f9119442258 100644 (file)
@@ -2698,16 +2698,16 @@ for which LSP on-type-formatting should be requested."
                                        (eglot--range-region range)))
                             (delete-region beg end)
                             (goto-char beg)
-                            (funcall (or snippet-fn #'insert) newText)))
-                        (when (cl-plusp (length additionalTextEdits))
-                          (eglot--apply-text-edits additionalTextEdits)))
+                            (funcall (or snippet-fn #'insert) newText))))
                        (snippet-fn
                         ;; A snippet should be inserted, but using plain
                         ;; `insertText'.  This requires us to delete the
                         ;; whole completion, since `insertText' is the full
                         ;; completion's text.
                         (delete-region (- (point) (length proxy)) (point))
-                        (funcall snippet-fn (or insertText label)))))
+                        (funcall snippet-fn (or insertText label))))
+                 (when (cl-plusp (length additionalTextEdits))
+                   (eglot--apply-text-edits additionalTextEdits)))
                (eglot--signal-textDocument/didChange)
                (eldoc)))))))))