>From 6b5c37f00f73abf07a72d2bc2fe6edb99f8ee0a4 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Wed, 15 Feb 2023 15:16:15 +0100 Subject: [PATCH] Make completions without :sortText fall to back of the list * lisp/progmodes/eglot.el: String-lessp is safe with (string-lessp nil "foo") and (string-lessp "foo" nil), but defaulting to the empty string puts candidates to the top of the list. Nil will make the candidates fall to the end of the list. --- lisp/progmodes/eglot.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 5e761d3064f..c8620f4199f 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2782,10 +2782,9 @@ eglot-completion-at-point (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) -- 2.34.1