Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Cargo ScriptsNew to Visual Studio Code? Get it now.
Cargo Scripts

Cargo Scripts

taiyuuki

|
5,832 installs
| (2) | Free
Execute Cargo scripts from the sidebar.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Cargo Scripts for VS Code

Marketplace Version License

A Visual Studio Code extension that helps Rust developers run Cargo scripts directly from the sidebar - similar to npm scripts in package.json.

✨ Features

  • 🚀 Auto-detects .cargo/config.toml and Cargo.toml configurations
  • ⚡ One-click script execution via sidebar
  • 🔍 Auto-reload on config changes

🛠 Installation

  1. Open VS Code Extensions Marketplace
  2. Search for Cargo Scripts or taiyuuki.vscode-cargo-scripts
  3. Click Install
  4. Reload the editor

Or install via command line:

code --install-extension taiyuuki.vscode-cargo-scripts

🚦 Usage

Define your scripts in either .cargo/config.toml or Cargo.toml.

[alias] in .cargo/config.toml (Recommended)

Refer to The Cargo Book for details about the [alias] section.

Example configuration:

[alias]
r  = "run --release"
b = "build --release"
t = ["test", "--", "--nocapture"]

The scripts will appear in the CARGO SCRIPTS sidebar. Click the ▶️ icon next to any script to execute it.

Cargo.toml Configuration

Add a [package.metadata.scripts] or [workspace.metadata.scripts] section (for workspace projects).

Important notes:

  1. Commands must be full command-line strings (include cargo prefix)
  2. Workspace configuration takes precedence over package configuration

Example:

[package.metadata.scripts]
run = "cargo run"
build = "cargo build --release"
test = "cargo test -- --nocapture"

# For workspace projects
[workspace.metadata.scripts]
lint = "cargo clippy --all-targets -- -D warnings"
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft