GNU bug report logs -
#67609
29.1; (eglot-inlay-hints-mode -1) behaves surprisingly, does not work in cc-mode hooks
Previous Next
Full log
Message #8 received at 67609 <at> debbugs.gnu.org (full text, mbox):
On Sun, Dec 3, 2023 at 6:35 PM Morgon Kanter <morgon.kanter <at> gmail.com> wrote:
>
> eglot-inlay-hints-mode seems to always turn on, at least in cc-mode, even
> when explicitly disabled by a hook, leaving me to disable it once the
> buffer is loaded. For example, this is my config:
>
> (defun config:cc-defaults ()
> (c-toggle-comment-style 1)
> (subword-mode 1)
> (diminish 'subword-mode)
> (local-set-key (kbd "C-M-S-<backspace>") #'kill-outer-sexp-and-parens)
> ;; Run eglot if we're under a project.
> (when (project-current)
> (eglot-ensure)
> (eglot-inlay-hints-mode -1)))
> (add-hook 'c-mode-common-hook #'config:cc-defaults)
Hi. Because you're using 'eglot-ensure' (hint, maybe you
shoudn't, read the manual in the latest master for why)
it means that after the eglot-ensure form executes,
Eglot will not be setup yet, so the following form
has no effect. You need to replace it with
(add-hook 'eglot-managed-mode-hook (lambda ()
(eglot-inlay-hints-mode -1)) nil t)
So that when Eglot does start up, it knows to disable
inlay hints.
You may add the above line globally (with the trailing 'nil t') if
you never want inlay hints to be enabled automatically in any
mode or language server.
And see also eglot-ignored-server-capabilities and add consider
:inlayHintProvider to it if you don't even ever want to enable
it manually.
João
This bug report was last modified 1 year and 187 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.