vscode-devcontainercodespacesdevcontainer

How to add extension settings to devcontainer.json?


In a Codespaces .devcontainer/devcontainer.json file I may have the following:

"customizations": {
  "vscode": {
    "extensions": [
      "snowflake.snowflake-vsc"
    ]
  }
}

and in the Codespaces VS Code environment, I copy a setting I want to persist for all Codespaces environments, e.g.

"git.autofetch": true

I should note here that git appears to be a default extension either with VS code or the miniconda dockerfile base image I'm using. In any case, I think these two quoted concepts are related, or maybe they're not exactly, but I can't seem to find any guidance on how to actually persist the git setting. Any takers?


Solution

  • You cannot directly define extension settings in the devcontainer.json. But if you need these settings to be version controlled and persistent, they can be defined in .vscode/settings.json

    {
    "git.autofetch": true
    }