Rethink lsp defaults

+ Allow LSP to prompt to install servers. All this machinary just adds
more confusion for beginners, and at least LSP asks for your permission
before it does it.
+ Reverts lsp-enable-file-watchers and lsp-enable-indentation to their
default (enabled), hopefully to help lsp-java, lsp-dart, and lsp-clojure
users, for whom file-watchers seems to be necessary.
+ Apply GC/IPC optimizations globally, to ensure their reach. By only
setting them buffer-locally we don't have a guarantee that subprocesses
will be affected when the lsp buffer isn't focused.

Closes #3989

Co-authored-by: Eric Dallo <ercdll1337@gmail.com>
This commit is contained in:
Henrik Lissner
2020-10-11 18:13:59 -04:00
parent db07304c71
commit 22b6eaed03
4 changed files with 51 additions and 90 deletions

View File

@@ -2,7 +2,7 @@
(use-package! eglot
:commands eglot eglot-ensure
:hook (eglot-managed-mode . +lsp-init-optimizations-h)
:hook (eglot-managed-mode . +lsp-optimization-mode)
:init
(setq eglot-sync-connect 1
eglot-connect-timeout 10
@@ -34,11 +34,13 @@ server getting expensively restarted when reverting buffers."
(letf! (defun eglot-shutdown (server)
(if (or (null +lsp-defer-shutdown)
(eq +lsp-defer-shutdown 0))
(funcall eglot-shutdown server)
(prog1 (funcall eglot-shutdown server)
(+lsp-optimization-mode -1))
(run-at-time
(if (numberp +lsp-defer-shutdown) +lsp-defer-shutdown 3)
nil (lambda (server)
(unless (eglot--managed-buffers server)
(funcall eglot-shutdown server)))
(prog1 (funcall eglot-shutdown server)
(+lsp-optimization-mode -1))))
server)))
(funcall orig-fn server))))