lang/cc: add rtags support #305
This commit is contained in:
parent
a02edc1d01
commit
750b74379d
2 changed files with 51 additions and 4 deletions
|
@ -188,3 +188,48 @@ compilation database is present in the project.")
|
||||||
(set! :company-backend 'glsl-mode '(company-glsl))))
|
(set! :company-backend 'glsl-mode '(company-glsl))))
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; Rtags Support
|
||||||
|
;;
|
||||||
|
|
||||||
|
(def-package! rtags
|
||||||
|
:after cc-mode
|
||||||
|
:config
|
||||||
|
(if (not (executable-find "rdm"))
|
||||||
|
(warn "cc-mode: couldn't find rdm, disabling rtags support")
|
||||||
|
(add-hook! (c-mode c++-mode) #'rtags-start-process-unless-running)
|
||||||
|
(set! :jump '(c-mode c++-mode)
|
||||||
|
:definition #'rtags-find-symbol-at-point
|
||||||
|
:references #'rtags-find-references-at-point))
|
||||||
|
|
||||||
|
(setq rtags-autostart-diagnostics t
|
||||||
|
rtags-use-bookmarks nil
|
||||||
|
rtags-jump-to-first-match nil
|
||||||
|
rtags-results-buffer-other-window t)
|
||||||
|
|
||||||
|
(defun +cc|cleanup-rdm-maybe ()
|
||||||
|
"Shut down the rtags daemon, if it's running."
|
||||||
|
(when (and (processp rtags-rdm-process)
|
||||||
|
(not (memq (process-status rtags-rdm-process) '(exit signal)))
|
||||||
|
(not (doom-buffers-in-mode '(c-mode c++-mode))))
|
||||||
|
(rtags-cancel-process)))
|
||||||
|
(add-hook 'doom-cleanup-hook #'+cc|cleanup-rdm-maybe)
|
||||||
|
(add-hook 'rtags-jump-hook #'evil-set-jump)
|
||||||
|
(add-hook 'rtags-after-find-file-hook #'recenter))
|
||||||
|
|
||||||
|
(def-package! ivy-rtags
|
||||||
|
:when (featurep! :completion ivy)
|
||||||
|
:after rtags
|
||||||
|
:init
|
||||||
|
;; NOTE Ivy integration breaks when rtags is byte-compiled with Emacs 26 or
|
||||||
|
;; later, so we un-byte-compile it before we load it.
|
||||||
|
(eval-when-compile
|
||||||
|
(when (>= emacs-major-version 26)
|
||||||
|
(when-let* ((elc-file (locate-library "rtags.elc" t doom--package-load-path)))
|
||||||
|
(delete-file elc-file))))
|
||||||
|
:config (setq rtags-display-result-backend 'ivy))
|
||||||
|
|
||||||
|
(def-package! helm-rtags
|
||||||
|
:when (featurep! :completion helm)
|
||||||
|
:after rtags
|
||||||
|
:config (setq rtags-display-result-backend 'helm))
|
||||||
|
|
|
@ -8,14 +8,16 @@
|
||||||
(package! glsl-mode)
|
(package! glsl-mode)
|
||||||
(package! irony)
|
(package! irony)
|
||||||
(package! irony-eldoc)
|
(package! irony-eldoc)
|
||||||
(package! opencl-mode)
|
|
||||||
(package! modern-cpp-font-lock)
|
(package! modern-cpp-font-lock)
|
||||||
|
(package! opencl-mode)
|
||||||
(when (featurep! :feature syntax-checker)
|
|
||||||
(package! flycheck-irony))
|
|
||||||
|
|
||||||
(when (featurep! :completion company)
|
(when (featurep! :completion company)
|
||||||
(package! company-glsl :recipe (:fetcher github :repo "Kaali/company-glsl"))
|
(package! company-glsl :recipe (:fetcher github :repo "Kaali/company-glsl"))
|
||||||
(package! company-irony)
|
(package! company-irony)
|
||||||
(package! company-irony-c-headers))
|
(package! company-irony-c-headers))
|
||||||
|
|
||||||
|
(package! rtags)
|
||||||
|
(when (featurep! :completion ivy)
|
||||||
|
(package! ivy-rtags))
|
||||||
|
(when (featurep! :completion helm)
|
||||||
|
(package! helm-rtags))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue