From 893ddd5903e1b0345f22b124e5d6fe8fc89ef6af Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Sun, 19 Feb 2023 11:11:13 +0000 Subject: [PATCH] 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. --- 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 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) -- 2.39.2