Emacs: Replace company-lsp with company-capf.

company-lsp is no longer supported and will be deprecated soon.
This commit is contained in:
tastytea 2020-07-07 05:34:19 +02:00
parent 3b33519849
commit c6fdc804a5

View File

@ -1,6 +1,6 @@
;;; lsp.el --- Language Server Protocol. -*- lexical-binding: t; -*- ;;; lsp.el --- Language Server Protocol. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-07-07T05:30:48+0200> ;; Time-stamp: <2020-07-07T05:33:56+0200>
;;; Commentary: ;;; Commentary:
@ -20,7 +20,8 @@
(lsp-auto-guess-root t) ; Don't ask for project root. (lsp-auto-guess-root t) ; Don't ask for project root.
(lsp-eldoc-render-all t) (lsp-eldoc-render-all t)
(lsp-restart 'auto-restart) (lsp-restart 'auto-restart)
(lsp-enable-semantic-highlighting t)) ; Needs clangd 11(?). (lsp-enable-semantic-highlighting t) ; Needs clangd 11(?).
(lsp-prefer-capf t))
:config (progn :config (progn
(setq lsp-clients-clangd-args '("--compile-commands-dir=build")) (setq lsp-clients-clangd-args '("--compile-commands-dir=build"))
;; Add “-clang-tidy” to clangd args if the version supports it. ;; Add “-clang-tidy” to clangd args if the version supports it.
@ -30,7 +31,10 @@
(put 'lsp-clients-clangd-args 'safe-local-variable #'consp)) (put 'lsp-clients-clangd-args 'safe-local-variable #'consp))
:bind ("C-c C-f" . lsp-execute-code-action) :bind ("C-c C-f" . lsp-execute-code-action)
:hook ((c++-mode . lsp) :hook ((c++-mode . lsp)
(c-mode . lsp))) (c-mode . lsp)
;; ↓ See <https://github.com/emacs-lsp/lsp-mode/issues/1736>. ↓
(lsp-managed-mode
. (lambda () (setq-local company-backends '(company-capf))))))
;; Eye-candy and flycheck support for lsp-mode. ;; Eye-candy and flycheck support for lsp-mode.
(use-package lsp-ui (use-package lsp-ui
@ -51,13 +55,6 @@
:hook ((lsp-mode . lsp-ui-mode) :hook ((lsp-mode . lsp-ui-mode)
(lsp-ui-peek-mode . my/lsp-ws-toggle))) (lsp-ui-peek-mode . my/lsp-ws-toggle)))
;; Completions with lsp-mode.
(use-package company-lsp
:demand t
:after (lsp-mode company)
:custom (company-lsp-cache-candidates 'auto)
:config (push 'company-lsp company-backends))
;; ivy interface to lsp-mode. ;; ivy interface to lsp-mode.
(use-package lsp-ivy (use-package lsp-ivy
:demand t :demand t