Skip to content

Latest commit

 

History

History
121 lines (97 loc) · 4.48 KB

README.org

File metadata and controls

121 lines (97 loc) · 4.48 KB

:lang rust

Description

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

  • Code completion (doom-package:racer or an LSP server)
  • Syntax checking (doom-package:flycheck)
  • LSP support (for rust-analyzer and rls) (doom-package:rustic)
  • Snippets

Maintainers

  • @hlissner

Become a maintainer?

Module flags

+lsp
Enable LSP support for rustic-mode. Requires doom-module::tools lsp and a langserver (supports rust-analyzer and rls).
+tree-sitter
Leverages tree-sitter for better syntax highlighting and structural text editing. Requires doom-module::tools tree-sitter.

Packages

  • doom-package:rustic

Hacks

  • rustic has been modified not to automatically install lsp-mode or eglot if they’re missing. Doom expects you to have enabled the doom-module::tools lsp module yourself.

Changelog

This module does not have a changelog yet.

Installation

Enable this module in your doom! block.

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

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

Note that when the Rust language has updates, you are to run rustup such that it doesn’t upgrade itself:

rustup update --no-self-update

Other Requirements

  • If doom-module::editor format is enabled, you’ll need rustfmt: $ rustup component add rustfmt-preview.
  • Users with doom-module:+lsp enabled will need rust-analyzer (rls is supported, but deprecated).
  • Using the following commands requires:
    • cargo-process-check: $ cargo install cargo-check
    • cargo-process-clippy: $ rustup component add clippy-preview

Usage

🔨 This module’s usage documentation is incomplete. Complete it?

LSP support (rls or rust-analyzer)

This module supports LSP integration. For it to work you’ll need:

  1. To install rust-analyzer through your OS package manager (RLS is supported too, but it is deprecated).
  2. To enable the doom-module::tools lsp module.
  3. To enable the doom-module:+lsp flag on this module.

Format on save

Enable doom-module::editor format +onsave to get formatting on save with rustfmt. No additional configuration is necessary.

Keybinds

BindingDescription
<localleader> b acargo audit
<localleader> b bcargo build
<localleader> b Bcargo bench
<localleader> b ccargo check
<localleader> b Ccargo clippy
<localleader> b dcargo doc
<localleader> b ncargo update
<localleader> b ocargo outdated
<localleader> b rcargo run
<localleader> t acargo test
<localleader> t trun current test

Configuration

🔨 This module’s configuration documentation is incomplete. Complete it?

Enabling eglot support for Rust

Doom’s doom-module::tools lsp module has an doom-module:+eglot flag. Enable it and this module will use eglot instead.

Troubleshooting

Report an issue?

error[E0670]: `async fn` is not permitted in the 2015 edition

You may be seeing this error, despite having edition = "2018" in your Cargo.toml. This error actually originates from rustfmt, which the LSP server tries to invoke on save (if you have rustic-format-trigger or <a href=”doom-module::editor format”>doom-module::editor format enabled).

To fix this your project needs a rustfmt.toml with edition = "2018" in it.

Frequently asked questions

This module has no FAQs yet. Ask one?

Appendix

🔨 This module has no appendix yet. Write one?