From a4c7fdfd2d4b512043899a0b1ce88d84aa231f53 Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Tue, 26 May 2020 14:13:44 +0100 Subject: [PATCH] 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 --- lisp/progmodes/eglot.el | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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))))))) -- 2.39.2