Rust Assist - Context-Aware Rust Development Assistant

A VS Code extension that provides intelligent command suggestions for Rust projects, working independently of rust-analyzer.

Features

  • Smart Project Detection: Automatically detects your Rust project type (Leptos, Dioxus, Bevy, Slint, Tauri, and more)
  • Context-Aware Commands: Suggests relevant commands based on your cursor position and file context
  • Test Detection: Finds the nearest test function and suggests running it specifically
  • Makefile Integration: Parses and suggests Makefile targets when available
  • Framework-Specific Commands: Knows the right commands for each framework (e.g., cargo leptos watch, dx serve)
  • Works Without rust-analyzer: Continues working even when rust-analyzer crashes

Usage

Commands

  • Suggest Command (Cmd+Shift+S): Shows a list of suggested commands based on your current context
  • Run Project (Cmd+Shift+R): Runs the project with the appropriate command for your framework
  • Run Tests (Cmd+Shift+T): Runs tests, focusing on the nearest test if your cursor is near one
  • Build Project (Cmd+Shift+B): Builds the project with options for debug or release mode

Supported Frameworks

  • Generic Rust projects
  • Leptos
  • Dioxus
  • Bevy
  • Slint
  • Tauri
  • Yew
  • Egui
  • Actix-web
  • Rocket
  • Axum
  • Workspace projects

Configuration

  • rust-assist.maxSuggestions: Maximum number of command suggestions to show (default: 10)
  • rust-assist.terminalName: Name of the terminal to use for executing commands (default: "Rust Assist")
  • rust-assist.customFrameworks: Custom framework detection rules

Building from Source

Prerequisites

  • Node.js and npm
  • Rust toolchain
  • wasm-tools (>= 1.200)

Build Steps

# Install dependencies
npm install

# Build the WASM component
cargo build --target wasm32-unknown-unknown

# Compile TypeScript
npm run compile

# Run in VS Code
# Press F5 in VS Code to launch Extension Development Host

Running the Sample in the Web

As a pre-requisite follow the instructions here to generate necessary certificate to side load the extension into vscode.dev or insiders.vscode.dev.

Then compile the extension for the Web by running npm run esbuild, start a local extension server using npm run serve, open vscode.dev or insiders.vscode.dev in a browser and execute the command Install Extension from Location. As a location use https://localhost:5000.

Architecture

This extension uses WebAssembly Component Model to run a Rust-based analyzer that:

  1. Detects project types by analyzing Cargo.toml dependencies
  2. Parses Makefiles for custom targets
  3. Analyzes Rust source files to find tests near the cursor
  4. Suggests appropriate commands based on the context

The extension is designed to be fast and work independently of other Rust tools.

License

MIT