]> git.eshelyaron.com Git - emacs.git/commitdiff
Also consider label of a completionitem for snippets
authorGary Oberbrunner <garyo@oberbrunner.com>
Tue, 26 May 2020 13:13:44 +0000 (14:13 +0100)
committerJoão Távora <joaotavora@gmail.com>
Tue, 26 May 2020 13:14:25 +0000 (14:14 +0100)
Copyright-paperwork-exempt: yes

* eglot.el (eglot-completion-at-point): Consider label when
expanding snippets.

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

lisp/progmodes/eglot.el

index cc6029079af721cb63640af281fec54904b7488f..fe8eeee9aea0a843da0a19e49812f2aeda52328f 100644 (file)
@@ -2152,9 +2152,7 @@ is not active."
        :exit-function
        (lambda (proxy _status)
          (eglot--dbind ((CompletionItem) insertTextFormat
-                        insertText
-                        textEdit
-                        additionalTextEdits)
+                        insertText textEdit additionalTextEdits label)
              (funcall
               resolve-maybe
               (or (get-text-property 0 'eglot--lsp-item proxy)
@@ -2189,7 +2187,7 @@ is not active."
                     ;; whole completion, since `insertText' is the full
                     ;; completion's text.
                     (delete-region (- (point) (length proxy)) (point))
-                    (funcall snippet-fn insertText))))
+                    (funcall snippet-fn (or insertText label)))))
            (eglot--signal-textDocument/didChange)
            (eglot-eldoc-function)))))))