From a3b20f9bc085b807dd6064630b59e14613715fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Fri, 24 Jun 2022 10:35:07 +0100 Subject: [PATCH] Fix #981: Apply any additionalTextEdits unconditionally * eglot.el (eglot-completion-at-point): Apply any additionalTextEdits unconditionally. --- eglot.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eglot.el b/eglot.el index 4e28de18..887e52c4 100644 --- a/eglot.el +++ b/eglot.el @@ -2694,16 +2694,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)))))))))