]> git.eshelyaron.com Git - emacs.git/commit
Eglot: display completion label when safe
authorJoão Távora <joaotavora@gmail.com>
Thu, 23 Feb 2023 13:58:38 +0000 (13:58 +0000)
committerJoão Távora <joaotavora@gmail.com>
Thu, 23 Feb 2023 13:58:54 +0000 (13:58 +0000)
commite3be0dbf85c729447776d361ba56ada6b92f0149
tree1574dabd3c3f5ecff180e6d54800cee92f8b75fc
parent5286111ea1fe442d861cd4a940d86db3fd832139
Eglot: display completion label when safe

Originally reported in
https://github.com/joaotavora/eglot/discussions/1141 by "Mintsoup".

Eglot doesn't always show the LSP :label property of a CompletionItem
in the completion candidates.  That is because label is sometimes not
what should be inserted in the buffer in the end, the :insertText
property supercedes it.

But the label is usually more suitable for display nevertheless and if
the LSP CompletionItem contains either a snippet or a textEdit, it's
safe to display the label, since :exit-function will guarantee that a
suitable buffer insertion is performed.

This change reflects that awareness that when a textEdit is available,
it's acceptable to show the label.

* lisp/progmodes/eglot.el (eglot-completion-at-point): Adjust.
lisp/progmodes/eglot.el