1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 22:41:06 -08:00

Eglot: improve treatment of completion items without :sortText (bug#61532)

Previously, defaulting to the empty string put candidates without
:sortText to the top of the list.  since string-lessp is safe with nil
arguments, this makes them sort to the end instead.

* lisp/progmodes/eglot.el (eglot-completion-at-point): Simplify.
This commit is contained in:
Theodor Thornhill 2023-02-19 11:11:13 +00:00 committed by João Távora
parent 871cf33a45
commit 893ddd5903

View file

@ -2782,10 +2782,9 @@ for which LSP on-type-formatting should be requested."
(cl-sort completions (cl-sort completions
#'string-lessp #'string-lessp
:key (lambda (c) :key (lambda (c)
(or (plist-get (plist-get
(get-text-property 0 'eglot--lsp-item c) (get-text-property 0 'eglot--lsp-item c)
:sortText) :sortText)))))
"")))))
(metadata `(metadata (category . eglot) (metadata `(metadata (category . eglot)
(display-sort-function . ,sort-completions))) (display-sort-function . ,sort-completions)))
resp items (cached-proxies :none) resp items (cached-proxies :none)