2019-02-21 16:08:27 -05:00
|
|
|
;;; tools/lsp/config.el -*- lexical-binding: t; -*-
|
|
|
|
|
2019-02-26 22:57:34 -05:00
|
|
|
(setq lsp-session-file (concat doom-etc-dir "lsp-session")
|
|
|
|
lsp-auto-guess-root t
|
2019-05-17 02:05:33 -04:00
|
|
|
lsp-keep-workspace-alive nil
|
|
|
|
lsp-groovy-server-install-dir (concat doom-etc-dir "groovy-langserver/"))
|
2019-02-24 13:49:12 -05:00
|
|
|
|
2019-04-16 20:21:13 -04:00
|
|
|
(after! lsp-mode
|
2019-05-03 20:03:32 -04:00
|
|
|
(set-lookup-handlers! 'lsp-mode :async t
|
2019-06-29 00:33:07 +02:00
|
|
|
:documentation 'lsp-describe-thing-at-point
|
|
|
|
:definition 'lsp-find-definition
|
|
|
|
:references 'lsp-find-references)
|
2019-04-16 20:21:13 -04:00
|
|
|
|
2019-06-29 00:28:13 +02:00
|
|
|
;; The original `lsp' initializes too much, too quickly. Things like flycheck,
|
|
|
|
;; company, and yasnippet. Doom's modules already handle these just fine, so
|
|
|
|
;; leave it to us.
|
|
|
|
(advice-add #'lsp :override #'lsp!)
|
|
|
|
|
2019-04-16 20:21:13 -04:00
|
|
|
;; Don't prompt to restart LSP servers while quitting Emacs
|
|
|
|
(add-hook! 'kill-emacs-hook (setq lsp-restart 'ignore)))
|
2019-02-28 05:01:40 -05:00
|
|
|
|
2019-02-24 13:49:12 -05:00
|
|
|
|
2019-02-21 16:08:27 -05:00
|
|
|
(def-package! lsp-ui
|
|
|
|
:hook (lsp-mode . lsp-ui-mode)
|
2019-06-29 00:28:13 +02:00
|
|
|
:init
|
2019-07-18 15:27:20 +02:00
|
|
|
(add-hook 'lsp-ui-mode-hook
|
|
|
|
(defun +lsp-init-ui-flycheck-or-flymake-h ()
|
|
|
|
"Sets up flymake-mode or flycheck-mode, depending on `lsp-prefer-flymake'."
|
|
|
|
(unless (eq :none lsp-prefer-flymake)
|
|
|
|
(if (and (not (version< emacs-version "26.1"))
|
|
|
|
lsp-prefer-flymake)
|
|
|
|
(lsp--flymake-setup))
|
|
|
|
(require 'lsp-ui-flycheck)
|
|
|
|
(lsp-ui-flycheck-enable t))))
|
2019-02-21 16:08:27 -05:00
|
|
|
:config
|
|
|
|
(setq lsp-prefer-flymake nil
|
|
|
|
lsp-ui-doc-max-height 8
|
|
|
|
lsp-ui-doc-max-width 35
|
2019-05-17 02:05:33 -04:00
|
|
|
lsp-ui-sideline-ignore-duplicate t
|
|
|
|
;; lsp-ui-doc is redundant with and less invasive than
|
|
|
|
;; `+lookup/documentation'
|
|
|
|
lsp-ui-doc-enable nil)
|
2019-04-16 20:21:13 -04:00
|
|
|
|
2019-05-03 20:03:32 -04:00
|
|
|
(set-lookup-handlers! 'lsp-ui-mode :async t
|
|
|
|
:definition 'lsp-ui-peek-find-definitions
|
|
|
|
:references 'lsp-ui-peek-find-references))
|
2019-02-21 16:08:27 -05:00
|
|
|
|
2019-02-24 13:49:12 -05:00
|
|
|
|
2019-02-21 16:08:27 -05:00
|
|
|
(def-package! company-lsp
|
|
|
|
:when (featurep! :completion company)
|
2019-07-05 23:42:06 +02:00
|
|
|
:defer t
|
|
|
|
:init
|
2019-06-29 00:28:13 +02:00
|
|
|
;; Make sure that `company-capf' is disabled since it is incompatible with
|
|
|
|
;; `company-lsp' (see lsp-mode#884)
|
2019-07-18 15:27:20 +02:00
|
|
|
(add-hook 'lsp-mode-hook
|
|
|
|
(defun +lsp-init-company-h ()
|
|
|
|
(if (not (bound-and-true-p company-mode))
|
|
|
|
(add-hook 'company-mode-hook #'+lsp-init-company-h t t)
|
|
|
|
(setq-local company-backends
|
2019-07-05 23:42:06 +02:00
|
|
|
(cons 'company-lsp
|
|
|
|
(remq 'company-capf company-backends)))
|
2019-07-18 15:27:20 +02:00
|
|
|
(remove-hook 'company-mode-hook #'+lsp-init-company-h t)))))
|