From: Gary Oberbrunner Date: Tue, 26 May 2020 13:13:44 +0000 (+0100) Subject: Also consider label of a completionitem for snippets X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~215 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a4c7fdfd2d4b512043899a0b1ce88d84aa231f53;p=emacs.git Also consider label of a completionitem for snippets 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 --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index cc6029079af..fe8eeee9aea 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -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)))))))