Emacs: Add “-clang-tidy” to clangd args if possible.

This commit is contained in:
tastytea 2020-01-26 01:09:35 +01:00
parent ee9c8aac74
commit 8ee57b74f6

View File

@ -1,6 +1,6 @@
;;; common.el --- Common programming settings. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-01-25T05:33:07+0100>
;; Time-stamp: <2020-01-26T01:09:26+0100>
;;; Commentary:
@ -316,15 +316,22 @@ purpose or not wide enough."
;; Client for Language Server Protocol servers.
(use-package lsp-mode
:if (executable-find "clangd")
:after (whitespace)
:after (whitespace company)
:defines (lsp-clients-clangd-args)
:custom
(lsp-prefer-flymake nil) ; Disable flymake.
(lsp-auto-guess-root t) ; Don't ask for project root.
(lsp-clients-clangd-args '("-compile-commands-dir=build"))
(lsp-eldoc-render-all t) ; Display all eldoc information.
:config
;; Add “-clang-tidy” to clangd args if the version supports it.
(if (>= (company-clang-version) 9.0)
(setq lsp-clients-clangd-args
'("-compile-commands-dir=build -clang-tidy"))
(setq lsp-clients-clangd-args
'("-compile-commands-dir=build")))
(defun my/lsp-ws-toggle ()
(if lsp-ui-peek-mode
(my/whitespace-mode-off)