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))