Skip to content

Instantly share code, notes, and snippets.

@peterneave
Created October 14, 2024 03:50
Show Gist options
  • Save peterneave/e9748a742f71a2281d931321c9d2ea81 to your computer and use it in GitHub Desktop.
Save peterneave/e9748a742f71a2281d931321c9d2ea81 to your computer and use it in GitHub Desktop.
Rust Dev Container for VS Code
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
{
"name": "Rust",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/rust:latest",
"customizations": {
"vscode": {
"settings": {
"todo-tree.regex.regex": "(//|#|<!--|;|/\\*|^|^[ \\t]*(-|\\d+.))\\s*($TAGS)|todo!",
"rust-analyzer.check.command": "clippy",
"editor.formatOnSave": true,
"editor.defaultFormatter": "rust-lang.rust-analyzer",
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
"Cargo.toml": ".clippy.toml, .rustfmt.toml, Cargo.lock, clippy.toml, cross.toml, rust-toolchain.toml, rustfmt.toml"
}
},
"extensions": [
"dustypomerleau.rust-syntax",
"Gruntfuggly.todo-tree",
"tamasfe.even-better-toml",
"usernamehw.errorlens",
"vadimcn.vscode-lldb",
"streetsidesoftware.code-spell-checker"
]
}
},
// Use 'mounts' to make the cargo cache persistent in a Docker Volume.
"mounts": [
{
"source": "devcontainer-cargo-cache-${devcontainerId}",
"target": "/usr/local/cargo",
"type": "volume"
}
],
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "rustup update"
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment