Emacs: Replace company-clang-version with my/clangd-version.
This commit is contained in:
parent
c42cb09db7
commit
1d029a4ff9
|
@ -1,6 +1,6 @@
|
||||||
;;; global-variables.el --- Set global variables. -*- lexical-binding: t; -*-
|
;;; global-variables.el --- Set global variables. -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Time-stamp: <2020-01-26T01:07:21+0100>
|
;; Time-stamp: <2020-01-26T06:59:34+0100>
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;; * Set `slow-computer'.
|
;; * Set `slow-computer'.
|
||||||
|
@ -54,6 +54,11 @@
|
||||||
(defalias 'yes-or-no-p 'y-or-n-p) ; Just type y/n instead of yes/no.
|
(defalias 'yes-or-no-p 'y-or-n-p) ; Just type y/n instead of yes/no.
|
||||||
(savehist-mode t) ; Save minibuffer history.
|
(savehist-mode t) ; Save minibuffer history.
|
||||||
(global-auto-revert-mode t) ; Auto-revert file if changed on disk.
|
(global-auto-revert-mode t) ; Auto-revert file if changed on disk.
|
||||||
|
|
||||||
|
(defun my/clangd-version ()
|
||||||
|
"Returns the version of clangd as float."
|
||||||
|
(string-to-number
|
||||||
|
(nth 2 (split-string (shell-command-to-string "clangd --version")))))
|
||||||
)
|
)
|
||||||
|
|
||||||
(provide 'basics/global-variables)
|
(provide 'basics/global-variables)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;;; c++.el --- C++ settings. -*- lexical-binding: t; -*-
|
;;; c++.el --- C++ settings. -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Time-stamp: <2020-01-26T02:35:47+0100>
|
;; Time-stamp: <2020-01-26T06:58:53+0100>
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
|
||||||
|
@ -15,7 +15,8 @@
|
||||||
:after (flycheck projectile lsp-ui)
|
:after (flycheck projectile lsp-ui)
|
||||||
:if (executable-find "clang-tidy")
|
:if (executable-find "clang-tidy")
|
||||||
;; clang-tidy is built into clangd >= 9.
|
;; clang-tidy is built into clangd >= 9.
|
||||||
:if (< (cdr (company-clang-version)) 9.0)
|
:if (< (my/clangd-version) 9.0)
|
||||||
|
|
||||||
:config
|
:config
|
||||||
(defun my/clang-tidy-off ()
|
(defun my/clang-tidy-off ()
|
||||||
"Disable c/c++-clang-tidy."
|
"Disable c/c++-clang-tidy."
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;;; common.el --- Common programming settings. -*- lexical-binding: t; -*-
|
;;; common.el --- Common programming settings. -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Time-stamp: <2020-01-26T01:58:12+0100>
|
;; Time-stamp: <2020-01-26T07:00:14+0100>
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ purpose or not wide enough."
|
||||||
;; Client for Language Server Protocol servers.
|
;; Client for Language Server Protocol servers.
|
||||||
(use-package lsp-mode
|
(use-package lsp-mode
|
||||||
:if (executable-find "clangd")
|
:if (executable-find "clangd")
|
||||||
:after (whitespace company)
|
:after (whitespace)
|
||||||
:defines (lsp-clients-clangd-args)
|
:defines (lsp-clients-clangd-args)
|
||||||
|
|
||||||
:custom
|
:custom
|
||||||
|
@ -327,7 +327,7 @@ purpose or not wide enough."
|
||||||
:config
|
:config
|
||||||
(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.
|
||||||
(if (>= (cdr (company-clang-version)) 9.0)
|
(if (>= (my/clangd-version) 9.0)
|
||||||
(add-to-list 'lsp-clients-clangd-args "-clang-tidy" t))
|
(add-to-list 'lsp-clients-clangd-args "-clang-tidy" t))
|
||||||
|
|
||||||
(defun my/lsp-ws-toggle ()
|
(defun my/lsp-ws-toggle ()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user