Rust is a relatively new programming language. Development tools are still growing, but there are a couple of useful VS Code extensions for Rust development. In this (shorter than usual) article, we’ll look at the state-of-the-art and what extensions can raise your Rust development to the next level.
This extension is the cornerstone extension for Rust developers. rust-analyzer uses Language Server Protocol (LSP) to do what you expect from an official language extension. Here are a few examples:
- Semantic syntax highlighting.
- Code completion: add braces automatically, code snippets, auto import.
- Code navigation: find references, go to definition or implementation.
- Code assistance: inlay hints, code actions.
- Refactoring tools: rename symbols, extract functions and variables.
- Documentation: hover or open the official documentation.
- Run programs and tests.
If you don’t like bloating your VS Code, and only want to have one Rust extension, this is the one, without a doubt. For the complete set of features, visit the official website.
Keeping crates up-to-date can be complicated. crates helps manage dependencies at a glance.
One of the most interesting features is visualizing which dependencies are on their latest version and which are lagging.
It also allows opening the documentation or changing to a different, existing version.
Lastly, it provides several handy commands to fetch, replace, and update dependencies.
TOML files can be dry to work with. Even Better TOML provides a good amount of features to work with TOML files with ease:
- Syntax highlighting
- Semantic highlighting
- Syntax validation
crates, this extension is all you need to keep your TOML files in good shape.
LLDB is a powerful debugger that supports Rust. It provides extended debugging capabilities compared to the default debugger. CodeLLDB includes:
- Conditional breakpoints
- Function breakpoints
- Hardware data access breakpoints
- Disassembly view
- Loaded modules view
- Python scripting
- HTML rendering (useful to create visualizations)
- Launch configurations defaults
- Remote debugging
It also provides commands to access these features a la VS Code:
The Rust Flash Snippets extension offers a wide range of snippets. It has snippets for the main keywords and for more complex constructs, such as implementing types with a
new method, implementing the
Display trait, or testing methods.
My only complaint is that it’s not as user-friendly as I’d like. For example, creating a function allows tabbing to the parameters but not tabbing to the result type or the body.
Despite a few glitches, it is a versatile collection of snippets that expands on non-trivial constructs.
Rust is an amazing programming language complex enough to benefit from good IDE tools. I hope that the list of extensions above will help improve your developer flow when Rust-ing 🙂