Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>RA AssistNew to Visual Studio Code? Get it now.
RA Assist

RA Assist

eshonar

|
65 installs
| (2) | Free
Toggle between Host and Mu target for Rust Analyzer
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

RA Assist

A VS Code extension for toggling rust-analyzer between Host (x86_64) and MU (RISC-V accelerator) targets.

Features

  • Toggle rust-analyzer target via status bar button, keyboard shortcut, or command palette
  • Automatic RUSTFLAGS configuration (--cfg=host / --cfg=mu)
  • cargo.cfgs with ! prefix to gray out inactive cfg blocks in the editor
  • Configurable directory exclusions per mode
  • Status bar indicator showing current mode
  • Auto-fallback to Host mode if MU target file is missing
  • QEMU CodeLens: QEMU <ver> Debug / QEMU <ver> Release buttons above fn main() and #[test] functions
  • Automatic TOML formatter setup — configures even-better-toml with system taplo when taplo.toml exists

Installation

VS Code Marketplace

Search for "RA Assist" in the Extensions view (Ctrl+Shift+X), or run:

ext install eshonar.ra-assist

Install from VSIX

Download the .vsix file from GitHub Releases, then:

code --install-extension ra-assist-*.vsix

Usage

Toggle Target

Method Action
Status bar Click on Host or MU indicator
Keyboard Ctrl+Alt+T (Windows/Linux) or Cmd+Alt+T (Mac)
Command palette Ctrl+Shift+P then RA Assist: Toggle Target

Mode Behavior

Mode RUSTFLAGS rust-analyzer target
Host --cfg=host Default (native)
MU --cfg=mu Custom RISC-V target JSON

QEMU CodeLens

The extension adds a pair of CodeLens buttons above fn main() and #[test] functions — QEMU <ver> Debug and QEMU <ver> Release, where <ver> is the CXL version selected in the status bar hover. Clicking one runs the binary/test through QEMU via the configured runner script; Debug uses cargo's dev profile and Release adds --release.

  • fn main() → cargo run [--release] --package <name> with QEMU runner
  • #[test] → cargo test [--release] --package <name> -- <test> --exact --nocapture --include-ignored with QEMU runner

--include-ignored is always passed: the lens names one exact test, so without it a #[ignore] test would be filtered out instead of run.

The runner is set via a configurable environment variable (default: CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER), overriding .cargo/config.toml.

Debug and release builds land in separate target/ subdirectories, so alternating between the buttons does not invalidate the other's artifacts. Do not click both at once, though — the QEMU emulator is a single instance.

Configuration

Add to your .vscode/settings.json:

{
  "ra-assist.targetTriplePath": "xcena",
  "ra-assist.targetTriple": "riscv64imfdxmetis-unknown-none-elf.json",
  "ra-assist.muExcludeDirs": ["mu-builder"],
  "ra-assist.hostExcludeDirs": []
}

Settings

Setting Type Default Description
targetTriplePath string "xcena" Directory containing the target JSON (relative to workspace or absolute)
targetTriple string "riscv64imfdxmetis-unknown-none-elf.json" Target triple JSON filename
excludeDirs array [] Directories to exclude from rust-analyzer in all modes
muExcludeDirs array ["mu-builder"] Directories to exclude in MU mode
hostExcludeDirs array [] Directories to exclude in Host mode
qemuCodeLensEnabled boolean true Enable the QEMU Debug/Release CodeLens pair above fn main() and #[test]
qemuRunner string "./dev/run.sh --qemu" Runner command for QEMU execution
qemuRunnerEnvVar string "CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER" Environment variable for the cargo runner
qemuRunnerSearchPaths array ["dev/run.sh", "mjol/dev/run.sh"] Paths to search for the runner script (walked upward)
qemuTestArgs array [] Extra cargo-level arguments before -- (e.g. ["--features", "foo"]). Profile flags (--release, --profile) are ignored — the Debug/Release buttons own the profile
qemuTestEnv object {} Extra environment variables for QEMU execution

How It Works

When toggling modes, the extension:

  1. Updates rust-analyzer.cargo.extraEnv.RUSTFLAGS with the appropriate --cfg flag
  2. Updates rust-analyzer.runnables.extraEnv.RUSTFLAGS for Run/Debug buttons
  3. Sets rust-analyzer.cargo.cfgs with ! prefix to gray out inactive cfg blocks (e.g., ["mu", "!host"])
  4. Sets/removes rust-analyzer.cargo.target to the MU target JSON path
  5. Configures rust-analyzer.cargo.extraArgs for build-std (MU mode only)
  6. Updates rust-analyzer.files.excludeDirs based on mode-specific exclusion lists
  7. Restarts rust-analyzer to apply changes
  8. If taplo.toml exists, configures TOML formatter (even-better-toml) to use system taplo binary

Requirements

  • VS Code 1.75.0 or higher
  • rust-analyzer extension
  • For MU mode: valid target triple JSON file in the configured path

License

Apache-2.0

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft