Thanks to visit codestin.com
Credit goes to github.com

Skip to content

CCChisato/VsCode-CodeRunner-Setting-for-Rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

VsCode-CodeRunner-Setting-for-Rust

This configuration allows you to run Rust projects or individual .rs files directly in Visual Studio Code using the Code Runner extension.

📌 功能简介 | Features

✅ 自动识别 Cargo 项目 如果当前目录包含 Cargo.toml,将自动使用 cargo run 运行整个项目。 This ensures that full Rust projects are executed correctly with proper build and dependency management.

✅ 支持单个 .rs 文件运行 如果没有 Cargo.toml,则使用 rustc 编译并运行单个 .rs 文件。 Ideal for quick tests, small programs, or learning Rust without a full project setup.

✅ 在终端中运行 所有 Rust code runs inside the terminal (not just output). Allows for interactive input/output, debugging, and better visibility of program behavior.

✅ 自动保存所有文件 Ensures that any unsaved changes are saved before execution starts.

⚙️ 配置内容 | Configuration Details: first

second

"""Add this"""

{
  "code-runner.executorMapByFileExtension": {
    ".rs": "if (Test-Path Cargo.toml) { cargo run } else { rustc $fileName && .\\$fileNameWithoutExt }"
  },
  "code-runner.runInTerminal": true,
  "code-runner.saveAllFilesBeforeRun": true
}

"""like this:"""

Screenshot 2025-06-14 111841

Screenshot 2025-06-14 111850

📌 Enjoy coding Rust smoothly in VSCode!

About

VsCode CodeRunner Setting for Rust 使用coderunner插件直接运行Rust项目或Rust文件

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published