22
23
constructor(
25
>
) {
26
>
collections.forEach((collection, extensionIdentifier) => {
27
>
this.populateDescriptionMap(collection, extensionIdentifier);
28
>
const it = collection.map.entries();
29
>
let next = it.next();
30
>
while (!next.done) {
31
>
const mutator = next.value[1];
32
>
const key = next.value[0];
33
>
34
>
if (this.blockPythonActivationVar(key, extensionIdentifier)) {
35
next = it.next();
36
continue;
37
}
39
>
let entry = this.map.get(key);
40
>
if (!entry) {
41
>
entry = [];
42
>
this.map.set(key, entry);
43
>
}
44
>
45
>
// If the first item in the entry is replace ignore any other entries as they would
46
>
// just get replaced by this one.
47
>
if (entry.length > 0 && entry[0].type === EnvironmentVariableMutatorType.Replace) {
48
next = it.next();
49
continue;
50
}
52
>
const extensionMutator = {
53
>
extensionIdentifier,
54
>
value: mutator.value,
55
>
type: mutator.type,
56
>
scope: mutator.scope,
57
>
variable: mutator.variable,
58
>
options: mutator.options
59
>
};
60
>
if (!extensionMutator.scope) {
61
>
delete extensionMutator.scope; // Convenient for tests
62
>
}
63
>
// Mutators get applied in the reverse order than they are created
64
>
entry.unshift(extensionMutator);
65
>
66
>
next = it.next();
67
>
}
68
>
});
69
>
}
70
71
async applyToProcessEnvironment(env: IProcessEnvironment, scope: EnvironmentVariableScope | undefined, variableResolver?: VariableResolver): Promise<void> {