emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/elpa 6d96601 52/71: Closes #509: fix sorting of complet


From: João Távora
Subject: [elpa] externals/elpa 6d96601 52/71: Closes #509: fix sorting of completion items
Date: Wed, 16 Dec 2020 11:42:25 -0500 (EST)

branch: externals/elpa
commit 6d9660152b6d86931a6b1dd25f81a354b77a5ae8
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Closes #509: fix sorting of completion items
    
    This fixes a problem pointed out by Yuwei Tian <ibluefocus@gmail.com>.
    
    * eglot.el (eglot-completion-at-point): Fix getting :sortText content
    of the completion item.
---
 eglot.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/eglot.el b/eglot.el
index 3e9c964..87fd9c8 100644
--- a/eglot.el
+++ b/eglot.el
@@ -2053,12 +2053,15 @@ is not active."
   ;; Commit logs for this function help understand what's going on.
   (when-let (completion-capability (eglot--server-capable :completionProvider))
     (let* ((server (eglot--current-server-or-lose))
-           (sort-completions (lambda (completions)
-                               (sort completions
-                                     (lambda (a b)
-                                       (string-lessp
-                                        (or (get-text-property 0 :sortText a) 
"")
-                                        (or (get-text-property 0 :sortText b) 
""))))))
+           (sort-completions
+            (lambda (completions)
+              (cl-sort completions
+                       #'string-lessp
+                       :key (lambda (c)
+                              (or (plist-get
+                                   (get-text-property 0 'eglot--lsp-item c)
+                                   :sortText)
+                                  "")))))
            (metadata `(metadata . ((display-sort-function . 
,sort-completions))))
            resp items (cached-proxies :none)
            (proxies



reply via email to

[Prev in Thread] Current Thread [Next in Thread]