]> git.eshelyaron.com Git - emacs.git/commitdiff
Protect against empty-string inserttext in completions
authorJoão Távora <joaotavora@gmail.com>
Wed, 6 Nov 2019 15:11:12 +0000 (15:11 +0000)
committerJoão Távora <joaotavora@gmail.com>
Sun, 10 Nov 2019 22:25:56 +0000 (22:25 +0000)
* eglot.el (eglot-completion-at-point): Don't use insertText as a
proxy.

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

lisp/progmodes/eglot.el

index 281a293c8994f6b0359375dbe5f4343a78c655ca..80c65cea5ce6f7a8c153d241b40389e43de025ff 100644 (file)
@@ -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))