From: "João Távora" <joaotavora@gmail.com>
To: Wilhelm Kirschbaum <wkirschbaum@gmail.com>
Cc: 64274@debbugs.gnu.org
Subject: bug#64274: 30.0.50; Eglot requests textDocument/documentSymbol if its not declared in the server capabilities
Date: Sun, 25 Jun 2023 00:06:00 +0100 [thread overview]
Message-ID: <871qi0795z.fsf@gmail.com> (raw)
In-Reply-To: <875y7c8ouk.fsf@gmail.com> (Wilhelm Kirschbaum's message of "Sun, 25 Jun 2023 00:35:22 +0200")
Wilhelm Kirschbaum <wkirschbaum@gmail.com> writes:
>> Thanks, i think the patch is in the right direction, but you could
>> use eglot--server-capable-or-lose.
>>
>
> The idea is to transparently just fall back to the non-eglot imenu and
> not sure if I want to see a warning for this every time imenu gets
> called. > Can you test it?
OK, this makes sense. Then please test this instead.
João
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index e2478f2dde3..c353ab6fce0 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -3348,9 +3348,11 @@ eglot--imenu-DocumentSymbol
(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
next prev parent reply other threads:[~2023-06-24 23:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-24 19:40 bug#64274: 30.0.50; Eglot requests textDocument/documentSymbol if its not declared in the server capabilities Wilhelm Kirschbaum
2023-06-24 20:07 ` Wilhelm Kirschbaum
2023-06-24 21:56 ` João Távora
2023-06-24 22:35 ` Wilhelm Kirschbaum
2023-06-24 23:06 ` João Távora [this message]
2023-06-24 23:21 ` Wilhelm Kirschbaum
2023-07-01 22:07 ` João Távora
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=871qi0795z.fsf@gmail.com \
--to=joaotavora@gmail.com \
--cc=64274@debbugs.gnu.org \
--cc=wkirschbaum@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).