Skip to content

Commit

Permalink
fixes #42626
Browse files Browse the repository at this point in the history
  • Loading branch information
isidorn committed Feb 1, 2018
1 parent e72ab44 commit 45e95c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/vs/workbench/parts/files/common/explorerModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export class FileStat implements IFileStat {
* exists locally.
*/
public static mergeLocalWithDisk(disk: FileStat, local: FileStat): void {
if (!disk || !local || disk.resource.toString() !== local.resource.toString()) {
if (disk.resource.toString() !== local.resource.toString()) {
return; // Merging only supported for stats with the same resource
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,11 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
return errorFileStat(targetsToResolve[index].resource, targetsToResolve[index].root);
});
// Subsequent refresh: Merge stat into our local model and refresh tree
modelStats.forEach((modelStat, index) => FileStat.mergeLocalWithDisk(modelStat, this.model.roots[index]));
modelStats.forEach((modelStat, index) => {
if (index < this.model.roots.length) {
FileStat.mergeLocalWithDisk(modelStat, this.model.roots[index]);
}
});

const statsToExpand: FileStat[] = this.explorerViewer.getExpandedElements().concat(targetsToExpand.map(expand => this.model.findClosest(expand)));
if (input === this.explorerViewer.getInput()) {
Expand All @@ -817,7 +821,9 @@ export class ExplorerView extends TreeViewsViewletPanel implements IExplorerView
.then(result => FileStat.create(result, target.root, target.options.resolveTo), err => errorFileStat(target.resource, target.root))
.then(modelStat => {
// Subsequent refresh: Merge stat into our local model and refresh tree
FileStat.mergeLocalWithDisk(modelStat, this.model.roots[index]);
if (index < this.model.roots.length) {
FileStat.mergeLocalWithDisk(modelStat, this.model.roots[index]);
}

let toExpand: FileStat[] = this.explorerViewer.getExpandedElements().concat(targetsToExpand.map(target => this.model.findClosest(target)));
if (input === this.explorerViewer.getInput()) {
Expand Down

0 comments on commit 45e95c6

Please sign in to comment.