Skip to content

VSCode Integration

While Rust is wonderful to work with- getting started with the tooling can be a bit daunting- everything's all over.

The Reloaded Project Template provides sane defaults for VSCode (Visual Studio Code) integration, including testing, code coverage, and professional Rust development workflows.

Quick Start

Install the recommended VSCode extensions:

  • rust-analyzer - Essential Rust language server providing IDE features (required for VSCode development)
  • Coverage Gutters - Visualize code coverage in your editor
  • Crates - Manage crate dependencies and versions

Info

Coverage tools are automatically installed when you first run coverage tasks.

Workspace Structure

The Reloaded template is designed to work with separate VSCode workspaces for different purposes:

Source Code Development (src)

Open the src folder in VSCode when doing Rust development work. This folder contains your Cargo.toml, source code, and tests. When opened as your workspace root, VSCode features work automatically:

  • CodeLLDB debug profiles generate automatically
  • Ctrl+Shift+B build task runs without configuration
  • rust-analyzer provides full IDE features
  • All development tasks are immediately available

Documentation Editing (doc)

Open the doc folder in VSCode when editing documentation. This folder contains your MkDocs project and markdown files. The doc workspace uses different VSCode settings optimized for documentation work.

Info

VSCode features like CodeLLDB debug profiles and the default build task (Ctrl+Shift+B) require the workspace root to be your Rust project root—where Cargo.toml is located. Open src for development and doc for documentation to ensure each tool works correctly.

Debugging

Install the CodeLLDB extension for native debugging support. Debug profiles are automatically created when the extension is installed and the src folder is opened as your workspace root.

VSCode Debugging

Debugging Rust applications with CodeLLDB in VSCode

Warning

If debug profiles are not available, run Ctrl+Shift+P → "Debug: Add Configuration..." to generate them manually.

Testing and Tasks

Access pre-configured development tasks via Ctrl+Shift+P → "Run Task". The template includes three essential workflows for automated testing and coverage generation.

Run Task

Access tasks via Ctrl+Shift+P → "Run Task"

Available Tasks

Pre-configured development tasks for testing and coverage

Formatting

The template configures VSCode to format Rust files automatically when saved using rustfmt.

Linting

Lints are checked on save, giving you fast feedback on code quality issues.

Clippy Linting

Clippy integration by default provides advanced linting out of the box

Tip

Combine this with VSCode's Auto Save feature for continuous error checking as you type.

This isn't enforced as it's user preference.

Coverage

Generate code coverage reports with cargo-tarpaulin and visualize them in your editor using coverage-gutters.

Run Coverage Task

Run "Auto Coverage on Save" task via Ctrl+Shift+P → "Run Task"

Preview Coverage Report

Preview coverage report via Ctrl+Shift+P → "Coverage Gutters: Preview Coverage Report"

Coverage Gutters

Coverage show covered (green) and uncovered (red) lines in editor.
Activate with Ctrl+Shift+PCoverage Gutter: Watch

Tip

Enable Coverage Gutters: Watch alongside Auto Coverage on Save for live coverage updates as you code.

Integrate with Non-Template Projects

Info

If your project was not built on Reloaded template, here's how you can recreate the VSCode setup parts.

Copy the template configuration files to your project and install the recommended extensions:

Create a .vscode directory in your Rust project root (where Cargo.toml is located) and copy these files. Then open your project's folder in VSCode to enable full functionality.

See the main documentation for more details.