With +extra enabled, this module would activate `prettify-symbols-mode` in any buffer where `prettify-symbols-alist` is non-nil, whether or not `+ligatures-extra-alist` has an entry for the current major mode (or a parent thereof). This behavior is poor UX, since the user may be expecting that a empty entry for some `X-mode` in `+ligatures-extra-alist` should mean *no` prettify-symbols-mode` at all in `X-mode`. With this, `+ligatures-extra-alist` is now the authority. An empty entry for `X-mode` will result in `prettify-symbols-mode` *not* being activated there. If that entry *isn't* empty, it will be combined only with the global default value of `prettify-symbols-alist`, not any pre-existing buffer-local value, to make the end result deterministic, because some modes have their own defaults for it (like `lisp-prettify-symbols-alist`, `js--prettify-symbols-alist`, and `rust-prettify-symbols-alist`). Fix: #7440 |
||
---|---|---|
.. | ||
autoload.el | ||
config.el | ||
doctor.el | ||
packages.el | ||
README.org |
:lang rust
Description unfold
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
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
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.
TODO Changelog
This module does not have a changelog yet.
Installation
Enable this module in your doom!
block.
This module requires a working installation of Rust for its more advanced features, and offer only syntax highlighting otherwise. The simplest way to install it is through rustup:
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# And can be updated later with:
$ rustup update --no-self-update
To install and manage Rust on Windows, consult Rust's official documentation.
Once installed, I recommended that you add Cargo's executable to your
$PATH
, so that the Emacs utilities that depend on it – or any tools installed through it – can easily locate them (without any added configuration on your part).Also, if you have used
$ doom env
in the past, changes to your$PATH
won't be visible to Doom until you run it (or$ doom sync
) again.
Other Requirements
- If doom-module::editor format is enabled, you'll need
rustfmt
:$ rustup component add rustfmt
. - 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
TODO Usage
This module's usage documentation is incomplete. Complete it?
LSP support (rust-analyzer)
This module supports rust-analyzer (RLS too, but it is deprecated), which must be installed outside of Emacs, typically with rustup or your OS package manager.
Installation through rustup is simplest:
$ rustup component add rust-analyzer rust-src
If your needs are more complex, consult rust-analyzer's documentation.
Finally, enable Doom's doom-module::tools lsp module, and this module's doom-module:+lsp flag (how to enable modules and their flags), and you're good to go!
Format on save
Enable doom-module::editor format +onsave to get formatting on save with
rustfmt
. No additional configuration is necessary.
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
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
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 [[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?
TODO Appendix
This module has no appendix yet. Write one?