Rust language server (rust-analyzer) providing code intelligence and analysis for .rs files. Use when working with Rust code that needs autocomplete, go-to-definition, find references, error detection, or refactoring support.
Rust language server integration providing comprehensive code intelligence through rust-analyzer.
.rsrustup component add rust-analyzer
brew install rust-analyzer
# Ubuntu/Debian
sudo apt install rust-analyzer
# Arch Linux
sudo pacman -S rust-analyzer
Download pre-built binaries from the releases page.
Verify installation:
rust-analyzer --version
The language server runs automatically in LSP-compatible editors. For manual operations:
cargo fmt
cargo clippy
cargo build
cargo test
cargo check
Create .rust-analyzer.json in project root:
{
"checkOnSave": {
"command": "clippy"
},
"inlayHints": {
"typeHints": true,
"parameterHints": true
}
}
When editing Rust code:
cargo fmt to format codecargo clippy for lintingcargo test before committingcargo new <name> - Create new projectcargo build - Compile projectcargo run - Build and runcargo test - Run testscargo check - Fast compile checkcargo clippy - Run lintercargo fmt - Format codecargo doc --open - Generate and open docs