From: Theodor Thornhill Date: Sun, 19 Feb 2023 11:11:13 +0000 (+0000) Subject: Eglot: improve treatment of completion items without :sortText (bug#61532) X-Git-Tag: emacs-29.0.90~394 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=893ddd5903e;p=emacs.git 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. --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 82401b685ce..d941aec4688 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2782,10 +2782,9 @@ for which LSP on-type-formatting should be requested." (cl-sort completions #'string-lessp :key (lambda (c) - (or (plist-get - (get-text-property 0 'eglot--lsp-item c) - :sortText) - ""))))) + (plist-get + (get-text-property 0 'eglot--lsp-item c) + :sortText))))) (metadata `(metadata (category . eglot) (display-sort-function . ,sort-completions))) resp items (cached-proxies :none)