aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodor Thornhill2023-02-19 11:11:13 +0000
committerJoão Távora2023-02-19 11:12:48 +0000
commit893ddd5903e1b0345f22b124e5d6fe8fc89ef6af (patch)
tree4d1c4ca194d1bb90ae622b1dda4925706313b7e6
parent871cf33a450a34fcace7fe7c5448fe3043697005 (diff)
downloademacs-893ddd5903e1b0345f22b124e5d6fe8fc89ef6af.tar.gz
emacs-893ddd5903e1b0345f22b124e5d6fe8fc89ef6af.zip
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.
-rw-r--r--lisp/progmodes/eglot.el7
1 files 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."
2782 (cl-sort completions 2782 (cl-sort completions
2783 #'string-lessp 2783 #'string-lessp
2784 :key (lambda (c) 2784 :key (lambda (c)
2785 (or (plist-get 2785 (plist-get
2786 (get-text-property 0 'eglot--lsp-item c) 2786 (get-text-property 0 'eglot--lsp-item c)
2787 :sortText) 2787 :sortText)))))
2788 "")))))
2789 (metadata `(metadata (category . eglot) 2788 (metadata `(metadata (category . eglot)
2790 (display-sort-function . ,sort-completions))) 2789 (display-sort-function . ,sort-completions)))
2791 resp items (cached-proxies :none) 2790 resp items (cached-proxies :none)