 ;;; tools/lsp/config.el -*- lexical-binding: t; -*-
 
 (defvar +lsp-company-backend 'company-lsp
-  "What backend to use for lsp-driven autocompletion, unless
-overridden by `+lsp-capf-blacklist'.
+  "What backend to use for lsp-driven autocompletion.
 
-While `company-capf' does not require the `company-lsp' package
-and should offer better performance, it has been integrated into
-lsp only recently and as of 02/25/2020 is known to cause issues
-with some language servers. If you wish to use `company-capf' in
-general but fall back to `company-lsp' for specific language
-servers, set `+lsp-company-backend' to `company-capf' and add the
+This can be overridden by `+lsp-capf-blacklist'.
+
+While `company-capf' does not require the `company-lsp' package and should offer
+better performance, it has been integrated into lsp only recently and as of
+02/25/2020 is known to cause issues with some language servers. If you wish to
+use `company-capf' in general but fall back to `company-lsp' for specific
+language servers, set `+lsp-company-backend' to `company-capf' and add the
 excluded servers' identifiers to `+lsp-capf-blacklist'.")
 
 (defvar +lsp-capf-blacklist '(ts-ls gopls)

                              (lambda (it) (format "[%s]" (lsp--workspace-print it)))
                              lsp--buffer-workspaces))))))

  ;; Don't prompt to restart LSP servers while quitting Emacs
  (add-hook! 'kill-emacs-hook (setq lsp-restart 'ignore)))


(use-package! lsp-ui
  :hook (lsp-mode . lsp-ui-mode)

  :config
  (setq lsp-ui-doc-max-height 8
        lsp-ui-doc-max-width 35

  ;; Auto-kill LSP server once you've killed the last buffer associated with its
  ;; project.
  (setq lsp-keep-workspace-alive nil)
  ;; Let `flycheck-check-syntax-automatically' determine this.
  (setq lsp-flycheck-live-reporting nil)
  ;; For `lsp-clients'
  (setq lsp-server-install-dir (concat doom-etc-dir "lsp/")
        lsp-groovy-server-install-dir (concat lsp-server-install-dir "lsp-groovy/")
        lsp-intelephense-storage-path (concat doom-cache-dir "lsp-intelephense/"))

  :config
  (set-lookup-handlers! 'lsp-mode :async t
    :documentation #'lsp-describe-thing-at-point
    :definition #'lsp-find-definition
    :references #'lsp-find-references)

  (when lsp-auto-configure
    (mapc (lambda (package) (require package nil t))
          lsp-client-packages))

  (defadvice! +lsp-init-a (&optional arg)
    "Enable `lsp-mode' in the current buffer.
