Don't trigger renderer sync when no change happened

This commit is contained in:
Daniel Imms
2020-03-27 07:51:51 -07:00
parent d91532afa8
commit 058bd5dbf7
3 changed files with 11 additions and 49 deletions

View File

@@ -657,18 +657,23 @@ export class EnvironmentVariableCollection implements vscode.EnvironmentVariable
}
replace(variable: string, value: string): void {
this.map.set(variable, { value, type: EnvironmentVariableMutatorType.Replace });
this._onDidChangeCollection.fire();
this._setIfDiffers(variable, { value, type: EnvironmentVariableMutatorType.Replace });
}
append(variable: string, value: string): void {
this.map.set(variable, { value, type: EnvironmentVariableMutatorType.Append });
this._onDidChangeCollection.fire();
this._setIfDiffers(variable, { value, type: EnvironmentVariableMutatorType.Append });
}
prepend(variable: string, value: string): void {
this.map.set(variable, { value, type: EnvironmentVariableMutatorType.Prepend });
this._onDidChangeCollection.fire();
this._setIfDiffers(variable, { value, type: EnvironmentVariableMutatorType.Prepend });
}
private _setIfDiffers(variable: string, mutator: vscode.EnvironmentVariableMutator): void {
const current = this.map.get(variable);
if (!current || current.value !== mutator.value || current.type !== mutator.type) {
this.map.set(variable, mutator);
this._onDidChangeCollection.fire();
}
}
get(variable: string): vscode.EnvironmentVariableMutator | undefined {