Update modules/lang/*
This commit is contained in:
parent
f0adef1b01
commit
e14e25ecb4
68 changed files with 1487 additions and 750 deletions
|
@ -1,25 +1,31 @@
|
|||
;;; module-rust.el
|
||||
|
||||
(use-package rust-mode
|
||||
(@def-package rust-mode
|
||||
:mode "\\.rs$"
|
||||
:init (add-hook 'rust-mode-hook 'flycheck-mode)
|
||||
:init
|
||||
(add-hook 'rust-mode-hook 'flycheck-mode)
|
||||
:config
|
||||
(def-builder! rust-mode "cargo run" "Cargo.toml")
|
||||
(def-builder! toml-mode "cargo run" "Cargo.toml"))
|
||||
(@set :build 'cargo-run '(rust-mode toml-mode)
|
||||
'+rust-is-cargo-project-p '+rust/cargo-run))
|
||||
|
||||
(use-package flycheck-rust
|
||||
:after rust-mode)
|
||||
|
||||
(defvar racer-cmd (concat doom-ext-dir "/racer"))
|
||||
(defvar racer-rust-src-path (concat doom-ext-dir "/rust/src/"))
|
||||
(use-package racer
|
||||
(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 (f-exists? racer-cmd)
|
||||
:init (add-hook! rust-mode '(racer-mode eldoc-mode flycheck-rust-setup))
|
||||
:when (file-exists-p racer-cmd)
|
||||
:init
|
||||
(@add-hook rust-mode '(racer-mode eldoc-mode flycheck-rust-setup))
|
||||
:config
|
||||
;; TODO Unit test keybinds
|
||||
(def-company-backend! rust-mode (racer))
|
||||
(map! :map rust-mode-map :m "gd" 'racer-find-definition))
|
||||
(@set :company-backend 'rust-mode '(company-racer))
|
||||
(@map :map rust-mode-map :m "gd" 'racer-find-definition))
|
||||
|
||||
|
||||
(@def-package company-racer
|
||||
:after racer)
|
||||
|
||||
|
||||
(@def-package flycheck-rust
|
||||
:after rust-mode)
|
||||
|
||||
(provide 'module-rust)
|
||||
;;; module-rust.el ends here
|
||||
|
|
10
modules/lang/rust/packages.el
Normal file
10
modules/lang/rust/packages.el
Normal file
|
@ -0,0 +1,10 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; lang/rust/packages.el
|
||||
|
||||
(@package racer)
|
||||
(@package rust-mode)
|
||||
|
||||
(when (@featurep :feature syntax-checker)
|
||||
(@package flycheck-rust))
|
||||
(when (@featurep :completion company)
|
||||
(@package company-racer))
|
25
modules/lang/rust/setup.sh
Executable file
25
modules/lang/rust/setup.sh
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source VARS
|
||||
|
||||
#
|
||||
echo "Setting up Rust"
|
||||
|
||||
case "$OSTYPE" in
|
||||
darwin*)
|
||||
brew install rust
|
||||
;;
|
||||
linux*)
|
||||
if is-arch; then
|
||||
sudo pacman --noconfirm -S rust cargo
|
||||
elif is-deb; then
|
||||
echo ...
|
||||
exit 1
|
||||
fi
|
||||
esac
|
||||
|
||||
git-repo "https://github.com/rust-lang/rust.git" "rust"
|
||||
git-repo "https://github.com/phildawes/racer.git" "racer-src"
|
||||
|
||||
cd racer-src && cargo build --release
|
||||
mv racer-src/target/release/racer ./racer
|
Loading…
Add table
Add a link
Reference in a new issue