Merge branch 'develop' of https://github.com/hlissner/doom-emacs into add-lsp-command-map

This commit is contained in:
James Ravn 2020-05-04 10:04:23 +01:00
commit fb3c6f9d78
No known key found for this signature in database
GPG key ID: 52C372C72159D6EE
205 changed files with 2592 additions and 1819 deletions

View file

@ -1,21 +1,5 @@
;;; tools/lsp/config.el -*- lexical-binding: t; -*-
(defvar +lsp-company-backend 'company-lsp
"What backend to use for lsp-driven autocompletion.
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)
"Language servers listed here will always use the `company-lsp' backend,
irrespective of what `+lsp-company-backend' is set to.")
(defvar +lsp-defer-shutdown 3
"If non-nil, defer shutdown of LSP servers for this many seconds after last
workspace buffer is closed.
@ -40,7 +24,6 @@ working on that project after closing the last buffer.")
(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/"))
;; Let doom bind the LSP keymap.
(setq lsp-keymap-prefix nil)
@ -60,7 +43,9 @@ working on that project after closing the last buffer.")
lsp-enable-semantic-highlighting nil
;; Don't modify our code without our permission
lsp-enable-indentation nil
lsp-enable-on-type-formatting nil)
lsp-enable-on-type-formatting nil
;; capf is the preferred completion mechanism for lsp-mode now
lsp-prefer-capf t)
:config
(set-popup-rule! "^\\*lsp-help" :size 0.35 :quit t :select t)
@ -124,26 +109,11 @@ This also logs the resolved project root, if found, so we know where we are."
(defun +lsp-init-company-h ()
(if (not (bound-and-true-p company-mode))
(add-hook 'company-mode-hook #'+lsp-init-company-h t t)
(let ((preferred-backend +lsp-company-backend))
(lsp-foreach-workspace
(when (memq (lsp--client-server-id (lsp--workspace-client lsp--cur-workspace))
+lsp-capf-blacklist)
(setq preferred-backend 'company-lsp)))
(if (eq 'company-capf preferred-backend)
;; use capf backend
(progn
(setq-local lsp-enable-completion-at-point t)
(setq-local lsp-prefer-capf t)
(setq-local company-backends
(cons 'company-capf (remq 'company-capf company-backends))))
;; use company-lsp backend (may need to be loaded first)
(require 'company-lsp)
(setq-local lsp-enable-completion-at-point nil)
(setq-local lsp-prefer-capf nil)
(setq-local company-backends
(cons 'company-lsp (remq 'company-capf company-backends)))
(setq-default company-lsp-cache-candidates 'auto))
(remove-hook 'company-mode-hook #'+lsp-init-company-h t))))
;; Ensure `company-capf' is at the front of `company-backends'
(setq-local company-backends
(cons 'company-capf
(remq 'company-capf company-backends)))
(remove-hook 'company-mode-hook #'+lsp-init-company-h t)))
(defun +lsp-init-flycheck-or-flymake-h ()
"Set up flycheck-mode or flymake-mode, depending on `lsp-diagnostic-package'."
(pcase lsp-diagnostic-package

View file

@ -1,11 +1,9 @@
;; -*- no-byte-compile: t; -*-
;;; tools/lsp/packages.el
(package! lsp-mode :pin "e8e52fd4b1")
(package! lsp-ui :pin "242dfe859c")
(when (featurep! :completion company)
(package! company-lsp :pin "f921ffa0cd"))
(package! lsp-mode :pin "941e6062a5b407675e13ba471e9878f4a2dbd10e")
(package! lsp-ui :pin "43f71e3837b07f377444ad631b12f8198c495aa7")
(when (featurep! :completion ivy)
(package! lsp-ivy :pin "a6b7841e08"))
(package! lsp-ivy :pin "81e81ced99829358674c5a6bbe2c3e15cecd4ed8"))
(when (featurep! :completion helm)
(package! helm-lsp :pin "46a72f5af1"))
(package! helm-lsp :pin "6b5ce182d7c94c62b55b8f7d0c7e643b2c30e560"))