Subject: bug#76142: closed (Re: bug#76142: [PATCH] Eglot: do not activate unsupported menu items)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 08 Feb 2025 13:33:02 +0000

Your bug report

#76142: [PATCH] Eglot: do not activate unsupported menu items

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
76142: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=76142
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#76142: [PATCH] Eglot: do not activate unsupported menu items
From: João Távora <[email-masked]>
To: Felician Nemeth <[email-masked]>
Cc: [email-masked]
Date: Sat, 8 Feb 2025 13:31:34 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

On Sat, Feb 8, 2025 at 11:45 AM Felician Nemeth
<[email-masked]> wrote:
>
> > Thanks, felicián.  Feel free to push and close this issue.
>
> I don't have access rights to push.

Ok, I pushed it for you.  I'll close the bug, but we can keep talking.

>
> > Re outline mode, I'm not sure it would help.  You can already use tab
> > to navigate buttons.
>
> I have not used call hierarchies long enough to have a strong opinion,
> but maybe starting with fully open hierarchy is more useful than the
> current closed one.

Opening the first node is feasible (and logical, since why else would
you invoke the hierarchy commands?) but expanding the whole tree
is impossible.  In general, especially when both directions are considered,
the tree is infinite.

> For example:
>
> [-]  ∘ funcb
>  |-[-]  ← funca
>  |  `-   ← main
>  `-   ← main
>
> vs:
>
> [+]  ∘ funcb
>
> And in the former case, 'Up' and 'Next Same Level' commands can be
> useful.

indeed.

> I don't know.  If Eglot just relies on the tree-widget library, then
> maybe that library should be enhanced with more navigation commands
> instead.

Yes.  tree-widget.el could come with some kind of tree-widget-mode with such
commands.  outline-mode is not a good choice, it's meant for plain text
with some markup.

I also don't know what other LSP extensions do with this graph.  If you have
more ideas to make it more interactive, pretty, etc, feel free to let me know
or push patches.  I think you should have commit rights to push to Eglot
directly.

João

Subject: [PATCH] Eglot: do not activate unsupported menu items
From: Felician Nemeth <[email-masked]>
To: [email-masked]
Date: Sat, 08 Feb 2025 12:13:37 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi João,

This small patch follows the current tradition of disabling menu items
that are known not to work with the current server.

By the way, the new eglot-hierarchy-mode looks really nice.  I wonder
if outline-minor-mode cloud somehow be enabled here.  Or if
eglot-hierarchy-mode cloud be derived from outline-mode.  Their
navigation commands are quite useful.

Thanks.

>From d5e02a79061394ccda7ee08137921ba7dfd75569 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felici=C3=A1n=20N=C3=A9meth?= <[email-masked]>
Date: Sat, 8 Feb 2025 11:53:31 +0100
Subject: [PATCH] Eglot: do not activate unsupported menu items

* lisp/progmodes/eglot.el (eglot-menu): Do not activate items that
the server does not support.
---
 lisp/progmodes/eglot.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 728227f0e9a..a69d239214f 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2311,8 +2311,10 @@ eglot-menu
     ["Quickfix" eglot-code-action-quickfix
      :visible (eglot-server-capable :codeActionProvider)]
     "--"
-    ["Show type hierarchy" eglot-show-type-hierarchy]
-    ["Show call hierarchy" eglot-show-call-hierarchy]
+    ["Show type hierarchy" eglot-show-type-hierarchy
+     :active (eglot-server-capable :typeHierarchyProvider)]
+    ["Show call hierarchy" eglot-show-call-hierarchy
+     :active (eglot-server-capable :callHierarchyProvider)]
     "--"))
 
 (easy-menu-define eglot-server-menu nil "Manage server communication"
-- 
2.39.5