emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Add `eglot-automatic-inlay-hints` customizable variable


From: Brennan Vincent
Subject: [PATCH] Add `eglot-automatic-inlay-hints` customizable variable
Date: Wed, 26 Apr 2023 12:33:43 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

I want inlay hints to be off by default, but be able to be turned on per-buffer
as desired. Adding inlay hints to eglot-ignored-server-capabilities achieves the
former, but makes the latter impossible.

---
 lisp/progmodes/eglot.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index ed554087084..cc742372627 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -403,6 +403,10 @@ eglot-report-progress
   :type 'boolean
   :version "29.1")
 +(defcustom eglot-automatic-inlay-hints t
+  "If non-nil, enable `eglot-inlay-hints-mode' by default."
+  :type 'boolean)
+
 (defvar eglot-withhold-process-id nil
   "If non-nil, Eglot will not send the Emacs process id to the language server.
 This can be useful when using docker to run a language server.")
@@ -1933,7 +1937,8 @@ eglot--maybe-activate-editing-mode
       (eglot--signal-textDocument/didOpen)
       ;; Run user hook after 'textDocument/didOpen' so server knows
       ;; about the buffer.
-      (eglot-inlay-hints-mode 1)
+      (when eglot-automatic-inlay-hints
+        (eglot-inlay-hints-mode 1))
       (run-hooks 'eglot-managed-mode-hook))))
  (add-hook 'after-change-major-mode-hook 'eglot--maybe-activate-editing-mode)
-- 
2.39.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]