Search code examples
visual-studio-codevscode-devcontainergithub-copilot

How to load github.copilot without specifying in devcontainer.json?


Here is a devcontainer.json I am successfully using:

// Documentation:
//  - https://github.com/devcontainers/images/tree/main/src/jekyll
//  - https://github.com/devcontainers/features/tree/main/src/node

{
    "name": "Jekyll",
    "image": "mcr.microsoft.com/devcontainers/jekyll",
    "features": {
        // Install latest stable Node
        "ghcr.io/devcontainers/features/node:1": {
            "version": "lts"
        }
    },
    "customizations": {
        "vscode": {
            "extensions": [
                "github.copilot",
                "html-validate.vscode-html-validate"
            ]
        }
    }
}

However I have specified github.copilot which is really only my business. I pay for Copilot and when I load this project I want Copilot in it.

If you load this project and you don't pay for Copilot you don't want Copilot in it.

If I am publishing this project for many people to use, can I remove the "github.copilot" line and also configure my own workspace across all my devices so that I always have Copilot running when opening this?


Solution

  • You can remove copilot from your devcontainer.json and add copilot to your "Always installed" extensions User setting. As a User setting it is independent of the project, and shouldn't affect other users.

    "dev.containers.defaultExtensions": [
        "github.copilot"
    ]
    

    More info here: https://code.visualstudio.com/docs/devcontainers/containers#_always-installed-extensions