tools/lsp: enable flymake or flycheck, not both

And only enable flycheck if it is installed.
This commit is contained in:
Henrik Lissner 2019-09-30 12:42:56 -04:00
parent 3f7e0fd103
commit 9026efcf5a
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -35,12 +35,13 @@ This can be a single company backend or a list thereof. It can be anything
(add-hook! 'lsp-ui-mode-hook (add-hook! 'lsp-ui-mode-hook
(defun +lsp-init-ui-flycheck-or-flymake-h () (defun +lsp-init-ui-flycheck-or-flymake-h ()
"Sets up flymake-mode or flycheck-mode, depending on `lsp-prefer-flymake'." "Sets up flymake-mode or flycheck-mode, depending on `lsp-prefer-flymake'."
(unless (eq :none lsp-prefer-flymake) (cond ((eq :none lsp-prefer-flymake))
(if (and (not (version< emacs-version "26.1")) ((and (not (version< emacs-version "26.1"))
lsp-prefer-flymake) lsp-prefer-flymake)
(lsp--flymake-setup)) (lsp--flymake-setup))
((require 'flycheck nil t)
(require 'lsp-ui-flycheck) (require 'lsp-ui-flycheck)
(lsp-ui-flycheck-enable t)))) (lsp-ui-flycheck-enable t)))))
:config :config
(setq lsp-prefer-flymake nil (setq lsp-prefer-flymake nil
lsp-ui-doc-max-height 8 lsp-ui-doc-max-height 8