LSP: Add some clangd arguments.

This commit is contained in:
tastytea 2021-04-16 03:58:41 +02:00
parent 4e1632ee2d
commit 548a230859
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 8 additions and 1 deletions

View File

@ -34,9 +34,16 @@
;; (lsp-face-semhl-enum ((t (:inherit font-lock-type-face))))
:config (progn
(setq lsp-clients-clangd-args '("--compile-commands-dir=build"))
;; Add “-clang-tidy” to clangd args if the version supports it.
(when (>= (my/clangd-version) 9.0)
(add-to-list 'lsp-clients-clangd-args "--clang-tidy" t))
;; Ranking algorithm trained on snippets from a large C++ codebase.
(when (>= (my/clangd-version) 12.0)
(add-to-list 'lsp-clients-clangd-args
"--ranking-model=decision_forest" t))
;; Always enabled in >= 12.0
(when (< (my/clangd-version) 12.0)
(add-to-list 'lsp-clients-clangd-args "--recovery-ast" t)
(add-to-list 'lsp-clients-clangd-args "--background-index" t))
;; Mark lsp-clients-clangd-args as safe to override.
(put 'lsp-clients-clangd-args 'safe-local-variable #'consp)