]> git.eshelyaron.com Git - emacs.git/commitdiff
Eglot: bail out of eglot-imenu if no server capability (bug#64274)
authorJoão Távora <joaotavora@gmail.com>
Sat, 1 Jul 2023 21:48:07 +0000 (22:48 +0100)
committerJoão Távora <joaotavora@gmail.com>
Sat, 1 Jul 2023 21:49:49 +0000 (22:49 +0100)
* lisp/progmodes/eglot.el (eglot-imenu): Bail out if no
capability.

lisp/progmodes/eglot.el

index 94ca5c942452721a54359e50d37f4974d489f0a1..d9a835ae844a9aa62d5f6c4c19889ff0c3aced3f 100644 (file)
@@ -3350,9 +3350,11 @@ for which LSP on-type-formatting should be requested."
                             (mapcar (lambda (c) (apply #'dfs c)) children))))))
     (mapcar (lambda (s) (apply #'dfs s)) res)))
 
-(defun eglot-imenu ()
+(cl-defun eglot-imenu ()
   "Eglot's `imenu-create-index-function'.
 Returns a list as described in docstring of `imenu--index-alist'."
+  (unless (eglot--server-capable :textDocument/documentSymbol)
+    (cl-return-from eglot-imenu))
   (let* ((res (eglot--request (eglot--current-server-or-lose)
                               :textDocument/documentSymbol
                               `(:textDocument