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:
Henrik Lissner 2024-08-14 17:56:57 -04:00
parent 88666b1913
commit 173842ccea
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
2 changed files with 4 additions and 10 deletions

View file

@ -5,6 +5,9 @@
"Dispatch to call the currently used lsp client entrypoint"
(interactive)
(if (modulep! +eglot)
(eglot-ensure)
(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))))