]> git.eshelyaron.com Git - emacs.git/commitdiff
Eglot: improve treatment of completion items without :sortText (bug#61532)
authorTheodor Thornhill <theo@thornhill.no>
Sun, 19 Feb 2023 11:11:13 +0000 (11:11 +0000)
committerJoão Távora <joaotavora@gmail.com>
Sun, 19 Feb 2023 11:12:48 +0000 (11:12 +0000)
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

index 82401b685ceea25b5e00c3ac420e4da8fc0b28bf..d941aec4688b2de27c4ee24bd8400412c2b5c6c1 100644 (file)
@@ -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)