From 8ee57b74f6c6667319f045e96614034bcf065306 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sun, 26 Jan 2020 01:09:35 +0100 Subject: [PATCH] =?UTF-8?q?Emacs:=20Add=20=E2=80=9C-clang-tidy=E2=80=9D=20?= =?UTF-8?q?to=20clangd=20args=20if=20possible.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.d/programming/common.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/init.d/programming/common.el b/init.d/programming/common.el index 53799c8..2dcd4ba 100644 --- a/init.d/programming/common.el +++ b/init.d/programming/common.el @@ -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)