feat(settings): add settings.env field for environment variable configuration

Add support for defining environment variables in settings.json files.
These variables are loaded with the lowest priority:
1. System/process environment variables (highest)
2. .env files
3. settings.env (lowest/fallback)

This allows users to configure default environment variables in their
user or workspace settings without conflicting with existing env vars
or .env file values.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
tanzhenxin 2026-02-08 09:33:31 +08:00
parent 36931e1eab
commit 5f8884b60c
3 changed files with 224 additions and 4 deletions

View file

@ -116,6 +116,19 @@ const SETTINGS_SCHEMA = {
mergeStrategy: MergeStrategy.REPLACE,
},
// Environment variables fallback
env: {
type: 'object',
label: 'Environment Variables',
category: 'Advanced',
requiresRestart: true,
default: {} as Record<string, string>,
description:
'Environment variables to set as fallback defaults. These are loaded with the lowest priority: system environment variables > .env files > settings.env.',
showInDialog: false,
mergeStrategy: MergeStrategy.SHALLOW_MERGE,
},
general: {
type: 'object',
label: 'General',