emacs-diffs
[Top][All Lists]
Advanced

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

feature/eglot2emacs e72fa6d867 082/120: Experiment with grouping in xref


From: João Távora
Subject: feature/eglot2emacs e72fa6d867 082/120: Experiment with grouping in xref-backend-identifier-completion-table
Date: Thu, 20 Oct 2022 07:17:00 -0400 (EDT)

branch: feature/eglot2emacs
commit e72fa6d86764027d1c071b73cc83aef8d4d344de
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Experiment with grouping in xref-backend-identifier-completion-table
    
    Doesn't look very good.
    
    * eglot.el (xref-backend-identifier-completion-table): Add stuff.
    
    GitHub-reference: per https://github.com/joaotavora/eglot/issues/131
---
 lisp/progmodes/eglot.el | 38 ++++++++++++++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index b17bfd1b5c..eccd67c129 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2416,12 +2416,42 @@ Try to visit the target file for a richer summary line."
                       (let* ((cache eglot--workspace-symbols-cache)
                              (probe (gethash pat cache :missing)))
                         (if (eq probe :missing) (puthash pat (refresh pat) 
cache)
-                          probe))))
+                          probe)))
+                    (container (c)
+                      (plist-get (get-text-property
+                                  0 'eglot--lsp-workspaceSymbol c)
+                                 :containerName)))
           (lambda (string _pred action)
             (pcase action
-              (`metadata '(metadata
-                           (display-sort-function . identity)
-                           (category . eglot-indirection-joy)))
+              (`metadata `(metadata
+                           (cycle-sort-function
+                            . ,(lambda (completions)
+                                 (cl-sort completions
+                                          #'string-lessp
+                                          :key (lambda (c)
+                                                 (or (container c)
+                                                     "")))))
+                           (category . eglot-indirection-joy)
+                           ;; (annotation-function
+                           ;;  . ,(lambda (c)
+                           ;;       (plist-get (get-text-property
+                           ;;                   0 'eglot--lsp-workspaceSymbol 
c)
+                           ;;                  :containerName)))
+                           ;; (affixation-function
+                           ;;  . ,(lambda (comps)
+                           ;;       (mapcar (lambda (c)
+                           ;;                 (list c
+                           ;;                       (plist-get 
(get-text-property
+                           ;;                                   0 
'eglot--lsp-workspaceSymbol c)
+                           ;;                                  :containerName)
+                           ;;                       " bla"))
+                           ;;               comps)))
+                           (group-function
+                            . ,(lambda (c transformp)
+                                 (if (not transformp)
+                                     (container c)
+                                   c)))
+                           ))
               (`(eglot--lsp-tryc . ,point) `(eglot--lsp-tryc . (,string . 
,point)))
               (`(eglot--lsp-allc . ,_point) `(eglot--lsp-allc . ,(lookup 
string)))
               (_ nil)))))



reply via email to

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