From: João Távora Date: Sat, 1 Jul 2023 21:48:07 +0000 (+0100) Subject: Eglot: bail out of eglot-imenu if no server capability (bug#64274) X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f6e6d6c7302da1d4d18a9284576471b47da4b6af;p=emacs.git Eglot: bail out of eglot-imenu if no server capability (bug#64274) * lisp/progmodes/eglot.el (eglot-imenu): Bail out if no capability. --- 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