IDE Setup
Prerequisites: Installation
Next: Variables and Types
A good IDE setup makes a huge difference with Rust. The language server, rust-analyzer, provides real-time type inference, inline error squiggles, autocompletion, and refactoring — all driven by the same compiler that will ultimately build your code.
VS Code (Recommended)
Installation
- Install VS Code
- Install the rust-analyzer extension — Extension ID:
rust-lang.rust-analyzer - Optionally install Even Better TOML (
tamasfe.even-better-toml) forCargo.tomlsyntax highlighting
Recommended Settings
Add to .vscode/settings.json in your project (or to your user settings):
{
"rust-analyzer.checkOnSave.command": "clippy",
"rust-analyzer.cargo.features": "all",
"rust-analyzer.inlayHints.typeHints.enable": true,
"rust-analyzer.inlayHints.parameterHints.enable": true,
"editor.formatOnSave": true,
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer"
}
}
What rust-analyzer Gives You
- Inline type hints — see inferred types on every
letbinding (like Pylance for Python) - Autocompletion — methods, fields, and imports suggested as you type
- Red squiggles for compile errors — no need to run
cargo buildto find errors - Inline documentation on hover — see doc comments for any symbol
- Go to definition / Find all references — across your whole project
- Automatic import insertion —
usestatements added when you accept a completion - Refactoring — rename, extract function, fill all match arms
Useful Keyboard Shortcuts
| Action | Mac | Windows / Linux |
|---|---|---|
| Go to definition | F12 |
F12 |
| Show all references | ⇧F12 |
Shift+F12 |
| Rename symbol | F2 |
F2 |
| Trigger suggestions | ⌃Space |
Ctrl+Space |
| Format document | ⇧⌥F |
Shift+Alt+F |
| Open Problems panel | ⇧⌘M |
Ctrl+Shift+M |
RustRover / IntelliJ
JetBrains offers two options:
- RustRover — standalone IDE dedicated to Rust (free for non-commercial use). Download at jetbrains.com/rust.
- IntelliJ IDEA + Rust plugin — if you already have IntelliJ.
RustRover has the same feature set as rust-analyzer but embedded in JetBrains' polished UI, including integrated debugger (LLDB), profiler, and test runner with coverage. If you already live in IntelliJ for other languages, this is the natural choice.
Neovim
# Install rust-analyzer binary (if not already done via rustup)
rustup component add rust-analyzer
In Neovim, using lazy.nvim + nvim-lspconfig, add to your Lua config:
require("lspconfig").rust_analyzer.setup({
settings = {
["rust-analyzer"] = {
checkOnSave = { command = "clippy" },
cargo = { features = "all" },
},
},
})
For a full Rust Neovim setup, the rustaceanvim plugin gives the richest experience — it adds DAP debugging, hover actions, and runnables directly in the editor.
Verifying Your Setup
Open the logferry repository in your IDE:
- Open
src/lib.rs - Hover over a type like
IngestStats— you should see its documentation pop up - Ctrl+click (or
F12) oningest_chunkto jump to its definition - Make a deliberate type error (e.g. assign
"hello"to ausizefield) — a red squiggle should appear within a few seconds
If these work, rust-analyzer is running correctly.
Troubleshooting rust-analyzer in VS Code
rust-analyzer not working
- Ensure the component is installed:
rustup component add rust-analyzer - Reload the window:
Ctrl+Shift+P→ "Developer: Reload Window" - Check the output panel:
Ctrl+Shift+P→ "rust-analyzer: Show RA server logs"
Slow startup
rust-analyzer indexes the whole project on first open, which can take 30–60 seconds on large projects. The spinner in the status bar will disappear when it is ready.
See Also
- Your First Project — build something to test your setup
- Daily Workflow — the recommended inner loop for day-to-day development