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