Open VSX | Vscode Marketplace
A Complementary Tool to rust-analyzer to streamline your Rust development and enhance your productivity.
No unicorns or crabs were harmed during the creation of this tool.
- Open a Rust file in VS Code
- Position your cursor within a function, struct, module, or other symbols
- Click on the CodeLens buttons that appear above the symbol (▶︎ Run, Debug, ▶︎ Run Test, etc.)
- Use
Ctrl+R
(Cmd+R
on macOS) to quickly run the code at the cursor position
You can configure the extension using the command palette:
Use the override syntax for quick configuration changes:
- Press
Ctrl+Shift+R
(Cmd+Shift+R
on macOS). - Or, use
Ctrl+Shift+P
(Cmd+Shift+P
on macOS) and typeCargo Runner: Override Config
.
Directly edit project-specific settings:
- Use
Ctrl+Shift+P
(Cmd+Shift+P
on macOS) and typeCargo Runner: Edit Project Settings
to access a dropdown list of settings files (cargo-runner-settings.json
or.vscode/settings.json
) you can manually edit.
The following options can be used with the Cargo Runner: Override Config
command:
Option | Description | Project Setting | VSCode Setting | Example |
---|---|---|---|---|
--features |
Enable specific features | runnables.extraArgs |
rust-analyzer.cargo.features |
--features=my-feature,another-feature |
--no-default-features |
Disable default features | runnables.extraArgs |
rust-analyzer.cargo.noDefaultFeatures |
--no-default-features |
--cargo-target |
Set cargo target | runnables.extraArgs |
rust-analyzer.cargo.target |
--cargo-target=wasm32-unknown-unknown |
--target |
Set target in extraArgs | runnables.extraArgs |
rust-analyzer.runnables.extraArgs |
--target=wasm32-unknown-unknown |
--target-dir |
Use custom target directory | runnables.extraArgs |
rust-analyzer.cargo.targetDir |
--target-dir |
ENV_VAR=value |
Set environment variables | runnables.extraEnv |
rust-analyzer.runnables.extraEnv |
RUST_LOG=debug |
# |
Delimiter for test binary args | runnables.extraTestBinaryArgs |
rust-analyzer.runnables.extraTestBinaryArgs |
--release # --nocapture --exact |
+channel |
Set Rust toolchain channel | Creates rust-toolchain.toml |
Creates rust-toolchain.toml |
+nightly |
@ |
Append mode (start with it) | Appends to existing settings | Appends to existing settings | @ --release |
!! |
Reset all configurations | Resets all options | Resets all options | !! |
!features |
Reset features | Resets cargo.features |
Resets rust-analyzer.cargo.features |
!features |
!target |
Reset cargo target | Deletes cargo.target |
Resets rust-analyzer.cargo.target |
!target |
!targetDir |
Reset target directory | Deletes cargo.targetDir |
Resets rust-analyzer.cargo.targetDir |
!targetDir |
!channel |
Reset Rust toolchain | Removes rust-toolchain.toml |
Removes rust-toolchain.toml |
!channel |
!env |
Reset environment variables | Resets runnables.extraEnv |
Resets rust-analyzer.runnables.extraEnv |
!env |
!# |
Reset test binary args | Resets runnables.extraTestBinaryArgs |
Resets rust-analyzer.runnables.extraTestBinaryArgs |
!# |
! |
Reset extra args | Resets runnables.extraArgs |
Resets rust-analyzer.runnables.extraArgs |
! |
--features my-feature,another-feature
--no-default-features --release
DATABASE_URL=postgres://localhost/mydb DEBUG=true
@ --features my-feature
(Append mode - adds to existing settings)
cargoRunner.prioritySymbolKinds
: Symbol kinds to prioritize for CodeLens actionscargoRunner.logLevel
: Set the logging level for Cargo RunnercargoRunner.cargoHome
: Path to Cargo home directorycargoRunner.nextest.enable
: Enable cargo-nextest integration
We welcome contributions! Please feel free to submit pull requests or open issues on our GitHub repository.
This extension is licensed under the MIT License.