From: João Távora Date: Wed, 6 Nov 2019 15:11:12 +0000 (+0000) Subject: Protect against empty-string inserttext in completions X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~277 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c4f5e40ddb1fe1e39d3b86875e04aedf46ec8bd0;p=emacs.git Protect against empty-string inserttext in completions * eglot.el (eglot-completion-at-point): Don't use insertText as a proxy. GitHub-reference: fix https://github.com/joaotavora/eglot/issues/341 --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 281a293c899..80c65cea5ce 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1968,8 +1968,11 @@ is not active." (cond ((and (eql insertTextFormat 2) (eglot--snippet-expansion-fn)) (string-trim-left label)) + ((and insertText + (not (string-empty-p insertText))) + insertText) (t - (or insertText (string-trim-left label)))))) + (string-trim-left label))))) (unless (zerop (length item)) (put-text-property 0 1 'eglot--lsp-item item proxy)) proxy))