From: João Távora Date: Wed, 13 Jul 2022 15:42:10 +0000 (+0100) Subject: Experiment with grouping in xref-backend-identifier-completion-table X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~37 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e72fa6d86764027d1c071b73cc83aef8d4d344de;p=emacs.git 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 --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index b17bfd1b5cd..eccd67c1296 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)))))