emacs-diffs
[Top][All Lists]
Advanced

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

master f6e6d6c7302 2/3: Eglot: bail out of eglot-imenu if no server capa


From: João Távora
Subject: master f6e6d6c7302 2/3: Eglot: bail out of eglot-imenu if no server capability (bug#64274)
Date: Sat, 1 Jul 2023 18:03:42 -0400 (EDT)

branch: master
commit f6e6d6c7302da1d4d18a9284576471b47da4b6af
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Eglot: bail out of eglot-imenu if no server capability (bug#64274)
    
    * lisp/progmodes/eglot.el (eglot-imenu): Bail out if no
    capability.
---
 lisp/progmodes/eglot.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 94ca5c94245..d9a835ae844 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -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



reply via email to

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