245
return current;
246
}
248
>
// Create a map to help
249
>
const otherMutatorExtensions = new Set<string>();
250
>
other.forEach(m => otherMutatorExtensions.add(m.extensionIdentifier));
251
>
252
>
// Find entries removed from other
253
>
const result: IExtensionOwnedEnvironmentVariableMutator[] = [];
254
>
current.forEach(mutator => {
255
>
if (!otherMutatorExtensions.has(mutator.extensionIdentifier)) {
256
result.push(mutator);
257
}
259
>
260
return result.length === 0 ? undefined : result;
261
}
262
264
>
current: IExtensionOwnedEnvironmentVariableMutator[],
265
>
other: IExtensionOwnedEnvironmentVariableMutator[] | undefined
266
>
): IExtensionOwnedEnvironmentVariableMutator[] | undefined {
267
>
// If it doesn't exist, none are changed (they are removed)
268
>
if (!other) {
269
return undefined;
270
}
272
>
// Create a map to help
273
>
const otherMutatorExtensions = new Map<string, IExtensionOwnedEnvironmentVariableMutator>();
274
>
other.forEach(m => otherMutatorExtensions.set(m.extensionIdentifier, m));
275
>
276
>
// Find entries that exist in both but are not equal
277
>
const result: IExtensionOwnedEnvironmentVariableMutator[] = [];
278
>
current.forEach(mutator => {
279
>
const otherMutator = otherMutatorExtensions.get(mutator.extensionIdentifier);
280
>
if (otherMutator && (mutator.type !== otherMutator.type || mutator.value !== otherMutator.value || mutator.scope?.workspaceFolder?.index !== otherMutator.scope?.workspaceFolder?.index)) {
281
// Return the new result, not the old one
282
result.push(otherMutator);
283
}
285
>
286
>
return result.length === 0 ? undefined : result;
287
>
}