Merge branch 'develop' of https://github.com/hlissner/doom-emacs into add-lsp-command-map
This commit is contained in:
commit
fb3c6f9d78
205 changed files with 2592 additions and 1819 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue