fix(lsp): advise eglot-ensure to always load

Advise eglot-ensure to only attempt to run when the mode in question has
a server configured
This commit is contained in:
Ellis Kenyo 2023-05-04 07:01:52 +01:00 committed by Henrik Lissner
parent a8dc291971
commit 81ec1a70d0

View file

@ -4,8 +4,16 @@
:commands eglot eglot-ensure
:hook (eglot-managed-mode . +lsp-optimization-mode)
:init
(defadvice! +eglot--ensure-available-mode (fn)
"Run `eglot-ensure' if the current mode has support."
:around #'eglot-ensure
(when (alist-get major-mode eglot-server-programs nil nil
(lambda (modes key)
(if (listp modes)
(member key modes)
(eq key modes))))
(funcall fn)))
(setq eglot-sync-connect 1
eglot-connect-timeout 10
eglot-autoshutdown t
eglot-send-changes-idle-time 0.5
;; NOTE We disable eglot-auto-display-help-buffer because :select t in