Ensure eglot does not take full control of Xref

Eglot by default will take full control of xref and make the
xref-backend-functions (eglot-xref-backend t) .

To have dumb-jump as backup if eglot would fail, instruct eglot to
stay out of Xref and add/remove eglot xref backend manually.
This commit is contained in:
Laurens Miers 2024-09-19 22:44:41 +02:00
parent 2c29e77132
commit 0482e48c7f

View file

@ -484,19 +484,17 @@ Install and wait for hydra to be available since we are using it in this init.el
** Eglot ** Eglot
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package eglot (use-package eglot
:ensure t :ensure t
:defer t )
;; This doesn't work for some reason, workaround below
;;:hook (prog-mode . eglot-ensure)
;; :config
;; (add-hook 'prog-mode-hook 'eglot-ensure)
)
#+END_SRC
Workaround to enable eglot in all programming modes: (setq eglot-stay-out-of '(xref))
#+BEGIN_SRC emacs-lisp (add-hook 'prog-mode-hook 'eglot-ensure)
(add-hook 'prog-mode-hook 'eglot-ensure) (add-hook 'eglot-managed-mode-hook (lambda ()
(if (eglot-managed-p)
(add-hook 'xref-backend-functions 'eglot-xref-backend)
(remove-hook 'xref-backend-functions 'eglot-xref-backend)
)))
#+END_SRC #+END_SRC
** Yasnippet ** Yasnippet