tools/lsp: reduce lsp's self-configuring eagerness
The original `lsp' initializes too much, too quickly. Things like flycheck, company, and yasnippet. Doom's modules already handle these just fine, so we advice it to leave it to us to handle. I intentionally avoid disabling lsp-auto-configure because doing so is much more destructive than I'd like. This update prevents lsp-ui-mode from being auto-enabled on lsp-mode. You can now (remove-hook 'lsp-mode-hook #'lsp-ui-mode) to disable lsp-ui. This update also adds these two hooks: + +lsp|init-company (on `lsp-mode-hook') + +lsp|init-ui-flycheck-or-flymake (on `lsp-ui-mode-hook')
This commit is contained in:
parent
380c3ac268
commit
a9ca62070c
2 changed files with 40 additions and 2 deletions
|
@ -1,4 +1,23 @@
|
|||
;;; feature/lsp/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autodef
|
||||
(defalias 'lsp! #'lsp)
|
||||
(defun lsp! (&optional arg)
|
||||
"Enable `lsp-mode' in the current buffer.
|
||||
|
||||
Meant to be a lighter alternative to `lsp', which is too eager about
|
||||
initializing lsp-ui-mode, company, yasnippet and flycheck. Instead, these have
|
||||
been moved out to their respective modules, or these hooks:
|
||||
|
||||
+ `+lsp|init-company' (on `lsp-mode-hook')
|
||||
+ `+lsp|init-ui-flycheck-or-flymake' (on `lsp-ui-mode-hook')"
|
||||
(when lsp-auto-configure
|
||||
(require 'lsp-clients))
|
||||
(when (and (buffer-file-name)
|
||||
(setq-local lsp--buffer-workspaces
|
||||
(or (lsp--try-open-in-library-workspace)
|
||||
(lsp--try-project-root-workspaces (equal arg '(4))
|
||||
(and arg (not (equal arg 1)))))))
|
||||
(lsp-mode 1)
|
||||
(lsp--info "Connected to %s."
|
||||
(apply 'concat (--map (format "[%s]" (lsp--workspace-print it))
|
||||
lsp--buffer-workspaces)))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue