scm: don't send events if nothing has changed

This commit is contained in:
Joao
2017-09-06 13:02:31 +02:00
parent b37a12e6a4
commit 2855c1cac3
2 changed files with 16 additions and 6 deletions

View File

@@ -310,12 +310,22 @@ class ExtHostSourceControl implements vscode.SourceControl {
@debounce(100)
eventuallyUpdateResourceStates(): void {
const resources: SCMRawResourceSplices[] = [];
const splices: SCMRawResourceSplices[] = [];
this.updatedResourceGroups
.forEach(group => resources.push([group.handle, group._snapshot()]));
this.updatedResourceGroups.forEach(group => {
const snapshot = group._snapshot();
if (snapshot.length === 0) {
return;
}
splices.push([group.handle, snapshot]);
});
if (splices.length > 0) {
this._proxy.$spliceResourceStates(this.handle, splices);
}
this._proxy.$spliceResourceStates(this.handle, resources);
this.updatedResourceGroups.clear();
}