Skip to content

Mathew-D/vs_code_rust

Repository files navigation

VS Code Rust Helper Extension

Overview

Dusome Rust is a VS Code extension that helps students quickly create Rust projects, add reusable modules, and build outputs for Linux, Windows, and WebAssembly.

Prerequisites

Core Rust tools

Install Rust and Cargo first.

Web builds

Run:

rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli

Windows builds from Linux

Run:

sudo pacman -S mingw-w64-gcc
rustup target add x86_64-pc-windows-gnu

Commands

Command palette commands

  • Rust: Show Menu
  • Rust: Create GUI Project
  • Rust: Create Script Project
  • Rust: Build Web Output (Advanced)
  • Rust: Build Web Output (Basic)
  • Rust: Run Program
  • Rust: Run Web Server
  • Rust: Add Advanced Help File From The Web
  • Rust: Add Configured Module From The Web
  • Dusome Rust: Set Repository URL
  • Dusome Rust: Open Extension Settings

Rust: Show Menu actions

  • Build: Linux Output
  • Build: Windows Output
  • Add Rust General Help File From The Web
  • Add Rust Advanced Help File From The Web
  • ⚙️ Plugin Settings
  • Configured module entries from dusome-rust.customWebModules

Managing Settings & Web Modules

Using the GUI (Recommended)

Run the ⚙️ Plugin Settings command from the VS Code command palette or select it from the Rust menu. This opens an interactive interface where you can:

Extension Settings:

  • Configure repository URL, rustfmt max width, window dimensions, and more
  • Toggle boolean settings like fullscreen, resizable, success notifications, and auto-create assets folder
  • Set author name and terminal name
  • All settings updated apply globally to your VS Code installation

Web Modules:

  • Add new custom modules with file name, menu label, and optional custom URL
  • Edit existing module entries
  • Delete modules
  • Reset modules to default modules

Changes are saved directly to your VS Code configuration.

Manual Configuration (Advanced)

You can also edit settings directly in VS Code's settings.json file or the extension settings. For more granular control over per-workspace module configuration, edit dusome-rust.customWebModules in your workspace settings.json file.

Settings

All settings are under the dusome-rust namespace.

Setting Type Default Description
dusome-rust.repositoryUrl string https://raw.githubusercontent.com/Mathew-D/rust-objects/main/ Base URL used to download modules and helper files. Must end with a slash.
dusome-rust.rustfmtMaxWidth number 150 Value written to rustfmt.toml when creating new projects.
dusome-rust.defaultWindowWidth number 1024 Default Macroquad window width in generated GUI projects.
dusome-rust.defaultWindowHeight number 768 Default Macroquad window height in generated GUI projects.
dusome-rust.defaultFullscreen boolean false Default Macroquad fullscreen value in generated GUI projects.
dusome-rust.defaultResizable boolean true Default Macroquad window_resizable value in generated GUI projects.
dusome-rust.cargoInitTimeoutMs number 90000 Timeout while waiting for Cargo.toml changes during GUI project setup.
dusome-rust.showSuccessNotifications boolean true Enables or disables extension success popups. Error and warning popups are still shown.
dusome-rust.terminalName string Cargo Terminal Name used for the extension terminal.
dusome-rust.autoCreateAssetsFolder boolean true Automatically creates an assets folder when creating new projects.
dusome-rust.authorName string Author name written into generated Rust project templates.
dusome-rust.customWebModules array prefilled Controls module download entries (fileName, optional url, menuLabel, successMessage) shown in Rust: Show Menu and in Rust: Add Configured Module From The Web. If url is set, it overrides repositoryUrl + fileName for that entry. Best managed via the Manage Web Modules GUI.

Troubleshooting

Build fails for web target

Cause: wasm32 target is missing.

Fix:

rustup target add wasm32-unknown-unknown

wasm-bindgen output is missing in pkg

Cause: wasm-bindgen-cli is not installed or is incompatible.

Fix:

cargo install wasm-bindgen-cli --force

Then run Rust: Build Web Output (Advanced) again.

Windows build fails on Linux

Cause: cross toolchain or target is not installed.

Fix:

sudo pacman -S mingw-w64-gcc
rustup target add x86_64-pc-windows-gnu

Downloaded modules fail or return 404

Cause: dusome-rust.repositoryUrl is wrong or missing trailing slash.

Fix:

  1. Run Dusome Rust: Set Repository URL.
  2. Use a URL that ends in a slash.
  3. Verify the repository contains the requested file names.

Too many success popups

Cause: Success notifications are enabled.

Fix: Set dusome-rust.showSuccessNotifications to false.

Cargo setup feels too slow on some machines

Cause: cargo init timing depends on machine and disk speed.

Fix: Increase dusome-rust.cargoInitTimeoutMs in settings.

Wrong window size/fullscreen in generated GUI project

Cause: defaults are configured in extension settings.

Fix: Adjust these settings and create a new GUI project:

  1. dusome-rust.defaultWindowWidth
  2. dusome-rust.defaultWindowHeight
  3. dusome-rust.defaultFullscreen
  4. dusome-rust.defaultResizable

Notes

  • Most day-to-day actions are available through Rust: Show Menu.

Installation

  1. Build or download the VSIX from: https://github.com/Mathew-D/vs_code_rust

License

MIT

About

VS Code Extension to help Rust in Macroquad programming

Topics

Resources

License

Stars

Watchers

Forks

Packages