70
71
async applyToProcessEnvironment(env: IProcessEnvironment, scope: EnvironmentVariableScope | undefined, variableResolver?: VariableResolver): Promise<void> {
73
>
if (isWindows) {
74
lowerToActualVariableNames = {};
75
Object.keys(env).forEach(e => lowerToActualVariableNames![e.toLowerCase()] = e);
76
}
78
>
const actualVariable = isWindows ? lowerToActualVariableNames![variable.toLowerCase()] || variable : variable;
79
>
for (const mutator of mutators) {
80
>
const value = variableResolver ? await variableResolver(mutator.value) : mutator.value;
81
>
82
>
if (this.blockPythonActivationVar(mutator.variable, mutator.extensionIdentifier)) {
83
continue;
84
}
86
>
// Default: true
87
>
if (mutator.options?.applyAtProcessCreation ?? true) {
88
>
switch (mutator.type) {
89
>
case EnvironmentVariableMutatorType.Append:
90
env[actualVariable] = (env[actualVariable] || '') + value;
91
break;
93
>
env[actualVariable] = value + (env[actualVariable] || '');
94
>
break;
95
>
case EnvironmentVariableMutatorType.Replace:
96
env[actualVariable] = value;
97
break;
99
>
}
100
>
// Default: false
101
>
if (mutator.options?.applyAtShellIntegration ?? false) {
102
const key = `VSCODE_ENV_${mutatorTypeToLabelMap.get(mutator.type)!}`;
103
env[key] = (env[key] ? env[key] + ':' : '') + variable + '=' + this._encodeColons(value);
104
}
106
>
}
107
>
}
108
109
private _encodeColons(value: string): string {