VSCode一键运行Rust

    {
        "key": "f5",
        "command": "workbench.action.terminal.sendSequence",
        "args": {
            "text": "cargo run\u000D"
        },
        "when": "inRustProject"
    }

添加到 Keybinding.json 中

References:

https://stackoverflow.com/questions/72925072/how-to-create-a-shortcut-to-build-and-run-rust-code-from-inside-vs-code

同时修改 CMake 拓展的快捷键防止冲突

    {
        "key": "f5",
        "command": "cmake.launchTarget",
        "when": "resourceLangId == cpp || resourceLangId == c"
    }


VSCode一键运行Rust
https://nekoside.com/archives/vscodeyi-jian-yun-xing-rust
作者
nekoside
发布于
2025年09月05日
更新于
2026年01月12日
许可协议