2017-06-08 11:47:56 +02:00
|
|
|
;;; lang/rust/config.el -*- lexical-binding: t; -*-
|
2015-09-30 12:28:52 -04:00
|
|
|
|
2017-09-19 05:07:24 +02:00
|
|
|
;;
|
|
|
|
;; Plugins
|
|
|
|
;;
|
2017-02-21 03:46:07 -05:00
|
|
|
|
2017-02-23 00:06:12 -05:00
|
|
|
(def-package! rust-mode
|
2015-09-30 12:28:52 -04:00
|
|
|
:mode "\\.rs$"
|
2016-05-01 01:10:30 -04:00
|
|
|
:config
|
2017-10-03 02:49:08 +02:00
|
|
|
(def-menu! +rust/build-menu
|
|
|
|
"TODO"
|
|
|
|
'(("run" :exec "cargo run" :cwd t :when (+rust-cargo-project-p))
|
|
|
|
("build" :exec "cargo build" :cwd t :when (+rust-cargo-project-p)))
|
|
|
|
:prompt "Cargo: "))
|
2015-09-30 12:28:52 -04:00
|
|
|
|
2015-11-30 05:31:20 -05:00
|
|
|
|
2017-02-23 00:06:12 -05:00
|
|
|
(def-package! racer
|
2016-04-23 22:08:46 -04:00
|
|
|
:after rust-mode
|
|
|
|
:config
|
2017-10-03 02:49:49 +02:00
|
|
|
(unless (file-exists-p racer-cmd)
|
2018-02-14 07:40:05 -05:00
|
|
|
(warn! "Couldn't find racer binary. Code completion won't work"))
|
2018-02-18 03:13:42 -05:00
|
|
|
(unless (file-directory-p racer-rust-src-path)
|
|
|
|
(warn! "Couldn't find rust source. Code completion won't work"))
|
2017-11-02 20:01:34 +01:00
|
|
|
|
2018-02-18 03:13:42 -05:00
|
|
|
(add-hook! 'rust-mode-hook #'(eldoc-mode racer-mode))
|
|
|
|
(set! :lookup 'rust-mode
|
|
|
|
:definition #'racer-find-definition
|
|
|
|
:documentation #'racer-describe))
|
2017-02-19 18:57:16 -05:00
|
|
|
|
|
|
|
|
2017-02-23 00:06:12 -05:00
|
|
|
(def-package! company-racer
|
2017-03-19 22:47:50 -04:00
|
|
|
:when (featurep! :completion company)
|
|
|
|
:after racer
|
|
|
|
:config (set! :company-backend 'rust-mode '(company-racer)))
|
2017-02-19 18:57:16 -05:00
|
|
|
|
|
|
|
|
2017-02-23 00:06:12 -05:00
|
|
|
(def-package! flycheck-rust
|
2017-03-19 22:47:50 -04:00
|
|
|
:when (featurep! :feature syntax-checker)
|
2017-09-19 05:07:24 +02:00
|
|
|
:after rust-mode
|
2017-12-08 22:33:12 -05:00
|
|
|
:hook (flycheck-mode . flycheck-rust-setup)
|
2018-02-28 17:14:33 -05:00
|
|
|
:init (add-hook 'rust-mode-hook #'flycheck-mode))
|
2015-09-30 12:28:52 -04:00
|
|
|
|