Make sure tha allViews are ready in remote explorer

Part of https://github.com/microsoft/vscode-remote-release/issues/1847
This commit is contained in:
Alex Ross
2019-11-15 10:05:32 +01:00
parent ee3a3406c6
commit 655df8fe0d

View File

@@ -350,22 +350,26 @@ export abstract class FilterViewContainerViewlet extends ViewContainerViewlet {
}));
this._register(this.viewsModel.onDidChangeActiveViews((viewDescriptors) => {
viewDescriptors.forEach(descriptor => {
let filterOnValue = this.getFilterOn(descriptor);
if (!filterOnValue) {
return;
}
if (!this.allViews.has(filterOnValue)) {
this.allViews.set(filterOnValue, new Map());
}
this.allViews.get(filterOnValue)!.set(descriptor.id, descriptor);
if (filterOnValue !== this.filterValue) {
this.viewsModel.setVisible(descriptor.id, false);
}
});
this.updateAllViews(viewDescriptors);
}));
}
private updateAllViews(viewDescriptors: IViewDescriptor[]) {
viewDescriptors.forEach(descriptor => {
let filterOnValue = this.getFilterOn(descriptor);
if (!filterOnValue) {
return;
}
if (!this.allViews.has(filterOnValue)) {
this.allViews.set(filterOnValue, new Map());
}
this.allViews.get(filterOnValue)!.set(descriptor.id, descriptor);
if (filterOnValue !== this.filterValue) {
this.viewsModel.setVisible(descriptor.id, false);
}
});
}
protected addConstantViewDescriptors(constantViewDescriptors: IViewDescriptor[]) {
constantViewDescriptors.forEach(viewDescriptor => this.constantViewDescriptors.set(viewDescriptor.id, viewDescriptor));
}
@@ -415,6 +419,10 @@ export abstract class FilterViewContainerViewlet extends ViewContainerViewlet {
}
onDidAddViews(added: IAddedViewDescriptorRef[]): ViewletPanel[] {
// Check that allViews is ready
if (this.allViews.size === 0) {
this.updateAllViews(this.viewsModel.viewDescriptors);
}
const panels: ViewletPanel[] = super.onDidAddViews(added);
for (let i = 0; i < added.length; i++) {
if (this.constantViewDescriptors.has(added[i].viewDescriptor.id)) {