]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't ignore unknown symbolkinds in imenu
authorMichal Krzywkowski <k.michal@zoho.com>
Wed, 31 Oct 2018 12:06:59 +0000 (13:06 +0100)
committerMichal Krzywkowski <k.michal@zoho.com>
Wed, 31 Oct 2018 12:06:59 +0000 (13:06 +0100)
Some servers provide custom SymbolKinds.  For example, ccls says that
symbols defined with #define are of kind 255.

* eglot.el (eglot-imenu): Don't delete elements with unknown symbol
  kind from the return list, instead put them in `(Unknown)` group.

lisp/progmodes/eglot.el

index 2b39849f9bc4b095def00d5083c0253ca62b600d..26ee814755ad2648fb8f71c6a976169877268c1e 100644 (file)
@@ -1658,16 +1658,16 @@ If SKIP-SIGNATURE, don't try to send textDocument/signatureHelp."
              (mapcar
               (jsonrpc-lambda
                   (&key name kind location _containerName _deprecated)
-                (cons (propertize name :kind (cdr (assoc kind eglot--symbol-kind-names)))
+                (cons (propertize
+                       name :kind (alist-get kind eglot--symbol-kind-names
+                                             "(Unknown)"))
                       (eglot--lsp-position-to-point
                        (plist-get (plist-get location :range) :start))))
               (jsonrpc-request (eglot--current-server-or-lose)
                                :textDocument/documentSymbol
                                `(:textDocument ,(eglot--TextDocumentIdentifier))))))
-        (cl-remove nil
-                   (seq-group-by (lambda (e) (get-text-property 0 :kind (car e)))
-                                 entries)
-                   :key #'car))
+        (seq-group-by (lambda (e) (get-text-property 0 :kind (car e)))
+                      entries))
     (funcall oldfun)))
 
 (defun eglot--apply-text-edits (edits &optional version)