doomemacs/modules/lang/rust/config.el
Henrik Lissner cb923eadcc
Add basic LSP support
Still needs to be documented, but includes support for the following
languages:

+ C/C++/ObjC
+ Go
+ Java
+ Javascript
+ OCaml
+ PHP
+ Python
+ Ruby
+ Scala
+ Swift
+ HTML/CSS

Relevant to #460, #716, #1186
2019-02-21 19:13:35 -05:00

33 lines
1,012 B
EmacsLisp

;;; lang/rust/config.el -*- lexical-binding: t; -*-
(after! rust-mode
(set-env! "RUST_SRC_PATH")
(set-docsets! 'rust-mode "Rust")
(setq rust-indent-method-chain t)
(when (featurep! +lsp)
(add-hook 'rust-mode-hook #'+lsp|init))
(map! :map rust-mode-map
:localleader
:prefix "b"
:desc "cargo build" "b" (λ! (compile "cargo build --color always"))
:desc "cargo check" "c" (λ! (compile "cargo check --color always"))
:desc "cargo run" "r" (λ! (compile "cargo run --color always"))
:desc "cargo test" "t" (λ! (compile "cargo test --color always"))))
(def-package! racer
:unless (featurep! +lsp)
:after rust-mode
:config
(add-hook 'rust-mode-hook #'racer-mode)
(set-lookup-handlers! 'rust-mode :async t
:definition #'racer-find-definition
:documentation #'racer-describe))
(def-package! flycheck-rust
:when (featurep! :feature syntax-checker)
:after rust-mode
:config (add-hook 'rust-mode-hook #'flycheck-rust-setup))