fix(lsp): eglot-ensure advice nooping in some major modes
Due to the nested structure of eglot-server-programs, our advice would not correctly detect entries for some modes (like javascript modes), effectively disabling Eglot in those modes. I've replaced the advice with a solution baked into lsp!, so folks still have the option of using eglot-ensure directly if they want it activated unconditionally. Amend: #7219
This commit is contained in:
parent
88666b1913
commit
173842ccea
2 changed files with 4 additions and 10 deletions
|
@ -4,15 +4,6 @@
|
|||
:commands eglot eglot-ensure
|
||||
:hook (eglot-managed-mode . +lsp-optimization-mode)
|
||||
:init
|
||||
(defadvice! +eglot--ensure-available-mode-a (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-autoshutdown t
|
||||
;; NOTE: We disable eglot-auto-display-help-buffer because :select t in
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
"Dispatch to call the currently used lsp client entrypoint"
|
||||
(interactive)
|
||||
(if (modulep! +eglot)
|
||||
(when (require 'eglot nil t)
|
||||
(if (eglot--lookup-mode major-mode)
|
||||
(eglot-ensure)
|
||||
(eglot--message "No client defined for %s" major-mode)))
|
||||
(unless (bound-and-true-p lsp-mode)
|
||||
(lsp-deferred))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue