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:
parent
a8dc291971
commit
81ec1a70d0
1 changed files with 9 additions and 1 deletions
|
@ -4,8 +4,16 @@
|
||||||
:commands eglot eglot-ensure
|
:commands eglot eglot-ensure
|
||||||
:hook (eglot-managed-mode . +lsp-optimization-mode)
|
:hook (eglot-managed-mode . +lsp-optimization-mode)
|
||||||
:init
|
: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
|
(setq eglot-sync-connect 1
|
||||||
eglot-connect-timeout 10
|
|
||||||
eglot-autoshutdown t
|
eglot-autoshutdown t
|
||||||
eglot-send-changes-idle-time 0.5
|
eglot-send-changes-idle-time 0.5
|
||||||
;; NOTE We disable eglot-auto-display-help-buffer because :select t in
|
;; NOTE We disable eglot-auto-display-help-buffer because :select t in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue