Environmental
Environmental adds a sidebar panel with environment management for debugging:
- Checkbox environments: Select multiple at once (standard behavior)
- Option groups: Choose one option from a group (radio-button style)
It reloads .vscode/envs.json before every debug start and merges the selected environment variables into the debug configuration.
envFile is supported for:
- checkbox environment entries
- option groups
- options inside a group
Merge precedence matches your requirement: envFile is loaded first, then inline env overrides keys from that file.
Commands
Environmental: Open Panel — Show the environment manager sidebar
Environmental: Reload envs.json — Force reload configurations
Environmental: Choose Environments — Quick-pick flow for checkbox environments and option groups
Checkbox-style environment
Multiple can be selected at once:
{
"environments": [
{
"name": "Local API",
"description": "Local backend and verbose logging",
"envFile": "${workspaceFolder}/.env.local",
"env": {
"API_BASE_URL": "http://localhost:8080",
"LOG_LEVEL": "debug"
}
}
]
}
Only one option per group can be selected:
{
"environments": [
{
"name": "Database Connection",
"description": "Choose your database target",
"envFile": ".env.db.common",
"env": {
"DB_PORT": "5432"
},
"options": [
{
"name": "local",
"envFile": ".env.db.local",
"env": {
"DB_HOST": "localhost",
"DB_NAME": "dev_db"
}
},
{
"name": "staging",
"envFile": ".env.db.staging",
"env": {
"DB_HOST": "staging-db.example.com",
"DB_NAME": "staging_db"
}
}
]
}
]
}
Mixed configuration
Combine both types in one file:
{
"environments": [
{
"name": "Enable Debug Logging",
"env": {
"DEBUG": "*"
}
},
{
"name": "API Endpoint",
"options": [
{
"name": "local",
"env": {
"API_URL": "http://localhost:8080"
}
},
{
"name": "production",
"env": {
"API_URL": "https://api.example.com"
}
}
]
}
]
}
How it works
- Sidebar panel shows all environments and option groups with checkboxes/radio buttons
- Checkbox environments can be toggled independently; multiple can be selected
- Option groups expand to show choices; only one option is selected per group
- Selection persists in workspace state between sessions
- Debug hook reloads
envs.json and merges selected configs into debugConfiguration.env before launching
- Choose Environments command first asks for checkbox entries, then asks one quick pick per group
envFile load order
For a selected checkbox environment:
- load
envFile
- overlay inline
env
For a selected option group:
- load group
envFile
- overlay group
env
- load selected option
envFile
- overlay selected option
env
Later layers win on key conflicts.
In the group quick-pick step, the currently selected option is shown first so pressing Enter keeps it.
State model
- Menu changes do not rewrite
.vscode/envs.json.
- Current selection state is stored in VS Code extension workspace state (per workspace).
envs.json defines available entries and env values only; current selection is managed by the extension state.
Customisation
Icons
You can add custom icons to your environments by including an icon property in your envs.json entries. The value can be a name of integrated VS Code icon or a path to a custom SVG file in your workspace. The icons
in VS Code are not really clear to me, but with some hope you can use colored icons from your
instance using file scheme. Check test enviroment for examples.