Add smarter eglot-ensure hooks
Check if language server exists and if file is part of a project before starting automatically
This commit is contained in:
parent
553eae89aa
commit
c0ba4c15ca
19
init.el
19
init.el
|
@ -902,7 +902,24 @@
|
|||
:bind ( :map prog-mode-map
|
||||
("C-c c a" . eglot-code-actions)
|
||||
("C-c c r" . eglot-rename))
|
||||
:hook ((eglot-managed-mode . (lambda () (add-hook 'flymake-diagnostic-functions 'eglot-flymake-backend nil t))))
|
||||
:hook ((eglot-managed-mode . (lambda () (add-hook 'flymake-diagnostic-functions 'eglot-flymake-backend nil t)))
|
||||
(nix-mode . (lambda () (if (and (project-current nil)
|
||||
(executable-find "nil" t))
|
||||
(eglot-ensure))))
|
||||
(python-base-mode . (lambda () (if (and (project-current nil)
|
||||
(or (executable-find "pyright" t)
|
||||
(executable-find "pylsp" t)))
|
||||
(eglot-ensure))))
|
||||
(lua-mode . (lambda () (if (and (project-current nil)
|
||||
(executable-find "lua-language-server" t))
|
||||
(eglot-ensure))))
|
||||
((rust-ts-mode rust-mode) . (lambda () (if (and (project-current nil)
|
||||
(executable-find "rust-analyzer" t))
|
||||
(eglot-ensure))))
|
||||
((js-base-mode typescript-ts-base-mode) . (lambda () (if (and (project-current nil)
|
||||
(executable-find "typescript-language-server" t))
|
||||
(eglot-ensure))))
|
||||
)
|
||||
:custom
|
||||
(eglot-menu-string "lsp")
|
||||
(eglot-send-changes-idle-time 1)
|
||||
|
|
Loading…
Reference in a new issue