lang/rust: refactor racer config + add +rust/install-racer command (WIP)
This commit is contained in:
parent
fd93e705b4
commit
6704736100
2 changed files with 18 additions and 3 deletions
11
modules/lang/rust/autoload.el
Normal file
11
modules/lang/rust/autoload.el
Normal file
|
@ -0,0 +1,11 @@
|
|||
;;; lang/rust/autoload.el
|
||||
|
||||
;;;###autoload
|
||||
(defun +rust/install-racer ()
|
||||
"Install and compile racer server."
|
||||
(interactive)
|
||||
(let ((racer-dir (expand-file-name "racer" +rust-cache-dir)))
|
||||
(doom-fetch :github "rust-lang/rust.git" (expand-file-name "rust" +rust-cache-dir))
|
||||
(doom-fetch :github "phildawes/racer.git" racer-dir)
|
||||
(let ((default-directory racer-dir))
|
||||
(doom-sh "cargo build --release"))))
|
|
@ -1,5 +1,8 @@
|
|||
;;; module-rust.el
|
||||
|
||||
(defvar +rust-cache-dir (concat doom-cache-dir "+rust/")
|
||||
"TODO")
|
||||
|
||||
(@def-package rust-mode
|
||||
:mode "\\.rs$"
|
||||
:init
|
||||
|
@ -9,14 +12,15 @@
|
|||
'+rust-is-cargo-project-p '+rust/cargo-run))
|
||||
|
||||
|
||||
(defvar racer-cmd (concat doom-cache-dir "racer"))
|
||||
(defvar racer-rust-src-path (concat doom-cache-dir "rust/src/"))
|
||||
(@def-package racer
|
||||
:after rust-mode
|
||||
:when (file-exists-p racer-cmd)
|
||||
:preface
|
||||
:init
|
||||
(@add-hook rust-mode '(racer-mode eldoc-mode flycheck-rust-setup))
|
||||
:config
|
||||
(setq racer-cmd (expand-file-name "racer/target/release/racer" +rust-cache-dir)
|
||||
racer-rust-src-path (expand-file-name "rust/src/" +rust-cache-dir))
|
||||
|
||||
;; TODO Unit test keybinds
|
||||
(@set :company-backend 'rust-mode '(company-racer))
|
||||
(@map :map rust-mode-map :m "gd" 'racer-find-definition))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue