Function: eglot--imenu-SymbolInformation

eglot--imenu-SymbolInformation is a byte-compiled function defined in eglot.el.gz.

Signature

(eglot--imenu-SymbolInformation RES)

Documentation

Compute imenu--index-alist for RES vector of SymbolInformation.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/eglot.el.gz
(defun eglot--imenu-SymbolInformation (res)
  "Compute `imenu--index-alist' for RES vector of SymbolInformation."
  (mapcar
   (pcase-lambda (`(,kind . ,objs))
     (cons
      (alist-get kind eglot--symbol-kind-names "Unknown")
      (mapcan
       (pcase-lambda (`(,container . ,objs))
         (let ((elems (mapcar
                       (eglot--lambda ((SymbolInformation) kind name location)
                         (let ((reg (eglot-range-region
                                     (plist-get location :range)))
                               (kind (alist-get kind eglot--symbol-kind-names)))
                           (cons (propertize name
                                             'breadcrumb-region reg
                                             'breadcrumb-kind kind)
                                 (car reg))))
                       objs)))
           (if container (list (cons container elems)) elems)))
       (seq-group-by
        (eglot--lambda ((SymbolInformation) containerName) containerName) objs))))
   (seq-group-by (eglot--lambda ((SymbolInformation) kind) kind) res)))