{
    "name": "esp32c6-dev",
    "build": {
        "dockerfile": "Dockerfile",
        "args": {
            "NIGHTLY_VERSION": "nightly-2025-11-01"
        }
    },
    // Privileged container to access /dev
    "privileged": true,
    // Mount USB bus so espflash can reach the connected board
    "mounts": [
        "source=/dev/bus/usb/,target=/dev/bus/usb/,type=bind"
    ],
    "runArgs": [
        "--device=/dev/ttyACM0",
        "--device=/dev/ttyACM1"
    ],
    "customizations": {
        "vscode": {
            "settings": {
                "editor.formatOnSave": true,
                "editor.formatOnSaveMode": "modifications",
                "files.watcherExclude": {
                    "**/target/**": true
                },
                "rust-analyzer.check.command": "clippy",
                "[rust]": {
                    "editor.defaultFormatter": "rust-lang.rust-analyzer"
                }
            },
            "extensions": [
                "rust-lang.rust-analyzer",
                "tamasfe.even-better-toml",
                "mutantdino.resourcemonitor",
                "probe-rs.probe-rs-debugger"
            ]
        }
    },
    "postCreateCommand": "DIALOUT_GID=$(stat -c '%g' /dev/ttyACM0 2>/dev/null || stat -c '%g' /dev/ttyACM1 2>/dev/null || echo 20) && (getent group dialout > /dev/null && sudo groupmod -g $DIALOUT_GID dialout || sudo groupadd -g $DIALOUT_GID dialout) && sudo usermod -aG dialout esp && USB_GID=$(stat -c '%g' /dev/bus/usb/*/* 2>/dev/null | sort -u | head -1 || echo 46) && (getent group plugdev > /dev/null && sudo groupmod -g $USB_GID plugdev || sudo groupadd -g $USB_GID plugdev) && sudo usermod -aG plugdev esp || true",
    "postStartCommand": "sudo chmod a+rw /dev/bus/usb/*/* 2>/dev/null; sudo chmod a+rw /dev/ttyACM* 2>/dev/null; true",
    "remoteUser": "esp",
    "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached",
    "workspaceFolder": "/workspace"
}
