Best VSCode extensions for Rust development

Introduction

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.

5 Best VS Code extensions for Rust development

1. rust-analyzer

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.
Best VS Code extensions for Rust development
Inline hints

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.

2. crates

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.

Outdated crates
Outdated crates

It also allows opening the documentation or changing to a different, existing version.

Open create documentation
Open create documentation

Lastly, it provides several handy commands to fetch, replace, and update dependencies.

Crates commands
Crates commands

3. Even Better TOML

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
  • Refactors
  • Completion
  • Formatting

Along with crates, this extension is all you need to keep your TOML files in good shape.

4. CodeLLDB

LLDB is a powerful debugger that supports Rust. It provides extended debugging capabilities compared to the default debugger. CodeLLDB includes:

  • Conditional breakpoints
  • Function breakpoints
  • Logpoints
  • Hardware data access breakpoints
  • Disassembly view
  • Loaded modules view
  • Python scripting
  • HTML rendering (useful to create visualizations)
  • Launch configurations defaults
  • Remote debugging
LLDB debugging
LLDB debugging

It also provides commands to access these features a la VS Code:

LLDB commands
LLDB commands

5. Rust Flash Snippets

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.

Conclusion

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 🙂

Similar Posts