doomemacs/modules/lang/rust
Henrik Lissner 45cdfb1258
Bump :core
spudlyo/clipetty@7ee3f9c -> spudlyo/clipetty@01b3904
bbatsov/projectile@eec569d -> bbatsov/projectile@5cd261d
noctuid/general.el@14ad4c8 -> noctuid/general.el@42e3803

We're also transitioning from abbreviated SHA1 hashes to full ones,
because underlying git machinery in future updates of straight will
require it (e.g. to obtain shallow clones of pinned packages).
2020-04-29 23:48:21 -04:00
..
autoload.el lang/rust: replace cargo.el w/ rustic-cargo #2108 2019-11-23 16:00:30 -05:00
config.el Use rustic-mode for rust org src blocks 2020-04-10 02:00:52 -04:00
doctor.el Refactor lang/rust lsp check 2020-02-29 19:09:50 -05:00
packages.el Bump :core 2020-04-29 23:48:21 -04:00
README.org Bump to brotzeit/rustic@6dead0c 2020-02-20 18:19:45 -05:00

lang/rust

Description

This module adds support for the Rust language and integration for its tools, e.g. cargo.

  • Code completion (racer)
  • Syntax checking (flycheck)
  • LSP support (for rls and rust-analyzer) (rustic)
  • Snippets

Module Flags

  • +lsp to add support Language server protocol.

Plugins

Hacks

  • rustic has been modified not to automatically install lsp-mode or elgot if they're missing. Doom expects you to enable the :tools lsp module yourself.
  • rustic's LSP integration has been disabled in favor of the rls/rust-analyzer support provider by the lsp-mode package.

Prerequisites

This module only requires rust, which can be acquired through rustup:

curl https://sh.rustup.rs -sSf | sh

Optionally, this module also uses the following programs:

  • racer (if not using LSP): cargo +nightly install racer (requires rust nightly)
  • RLS or rust-analyzer (for LSP users)
  • rustfmt for :editor format: rustup component add rustfmt-preview
  • The following commands require:

    • cargo-process-check: cargo install cargo-check
    • cargo-process-clippy: rustup component add clippy-preview

Features

This module also supports LSP, if you have the Rust Language Server or rust-analyzer installed. To enable it, you must enable the :tools lsp module and the +lsp flag on this module.

Keybinds

Binding Description
<localleader> b a cargo audit
<localleader> b b cargo build
<localleader> b B cargo bench
<localleader> b c cargo check
<localleader> b C cargo clippy
<localleader> b d cargo doc
<localleader> b n cargo update
<localleader> b o cargo outdated
<localleader> b r cargo run
<localleader> t a cargo test
<localleader> t t run current test

TODO Configuration

Enable rust-analyzer

You'll need rust-analyzer installed on your system, then use the following:

;; in $DOOMDIR/config.el
(setq rustic-lsp-server 'rust-analyzer)

Enabling elgot support for Rust

Doom doesn't have eglot support (yet), but if you've installed it yourself and want rust to use eglot instead of LSP, use the following:

;; in $DOOMDIR/config.el
(after! rustic
  (setq rustic-lsp-server 'rust-analyzer ; optional
        rustic-lsp-client 'eglot))

TODO Troubleshooting