Files
rust/.devcontainer/devcontainer.json
2025-10-21 14:05:16 +08:00

57 lines
1.2 KiB
JSON

{
"name": "Rust",
"image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye",
// 先构建项目,但不自动运行
"postStartCommand": "cargo build && clear",
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"streetsidesoftware.code-spell-checker",
"rust-lang.rust-analyzer", // 添加 Rust 语言支持
"vadimcn.vscode-lldb" // 添加 LLDB 调试器支持
],
// 添加调试配置
"debug": {
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug Rust Application",
"program": "${workspaceFolder}/target/debug/${workspaceFolderBasename}",
"args": [],
"cwd": "${workspaceFolder}",
"preLaunchTask": "cargo-build"
}
]
},
// 添加构建任务
"tasks": {
"tasks": [
{
"type": "cargo",
"command": "build",
"problemMatcher": [
"$rustc"
],
"group": "build",
"label": "cargo-build"
}
]
}
}
},
// 转发应用端口(根据你的实际端口修改)
"forwardPorts": [8080],
"portsAttributes": {
"8080": {
"label": "Rust Application",
"onAutoForward": "notify"
}
}
}