From 5cabbef6eff2478c32d0fda53e93d46156a3aafc Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 5 Jul 2019 23:42:06 +0200 Subject: [PATCH] tools/lsp: fix company-lsp not being enabled Due to a load-order issue between company and lsp. --- modules/tools/lsp/config.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/tools/lsp/config.el b/modules/tools/lsp/config.el index f2699ddd2..2313f2b08 100644 --- a/modules/tools/lsp/config.el +++ b/modules/tools/lsp/config.el @@ -48,10 +48,15 @@ (def-package! company-lsp :when (featurep! :completion company) - :after lsp-mode - :config + :defer t + :init ;; Make sure that `company-capf' is disabled since it is incompatible with ;; `company-lsp' (see lsp-mode#884) - (setq-hook! 'lsp-mode-hook company-backends - (cons 'company-lsp - (remq 'company-capf company-backends)))) + (defun +lsp|init-company () + (if (not (bound-and-true-p company-mode)) + (add-hook 'company-mode-hook #'+lsp|init-company t t) + (setq-local company-backends + (cons 'company-lsp + (remq 'company-capf company-backends))) + (remove-hook 'company-mode-hook #'+lsp|init-company t))) + (add-hook 'lsp-mode-hook #'+lsp|init-company))