[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#69683: 28.2; eglot overrides imenu without fallback even when unsupp
From: |
Eli Zaretskii |
Subject: |
bug#69683: 28.2; eglot overrides imenu without fallback even when unsupported by server |
Date: |
Sun, 10 Mar 2024 07:53:43 +0200 |
> From: Phil Hagelberg <phil@hagelb.org>
> Date: Sat, 09 Mar 2024 23:19:25 +0000
>
> When invoking M-x imenu in a buffer with eglot enabled, it uses eglot's
> LSP-aware implementation of imenu. However, not all LSP servers handle
> that functionality. When connected to a server that does not offer this
> functionality, eglot signals an error:
>
> jsonrpc-error: "request id=11 failed:", (jsonrpc-error-code . -32601),
> (jsonrpc-error-message . "\"textDocument/documentSymbol\" is not in the
> request-handlers table"), (jsonrpc-error-data)
>
> However, usually there is a perfectly good functional imenu
> implementation that the user wants to invoke; they just can't do it
> because eglot took over the imenu command.
>
> Ideally eglot should only add its functionality to the imenu command
> when it's connected to a server that actually supports the endpoint
> needed to handle it.
Thanks. Would you like to suggest a patch along these lines?
An alternative would be to catch this error and fall back on the imenu
implementation. Not being an LSP expert, I'm unsure which approach is
better/cleaner.