From cb852954bf5df39462740945dcbec4d2f643570a Mon Sep 17 00:00:00 2001 From: Anton Kosyakov Date: Mon, 9 Sep 2019 09:10:10 +0000 Subject: [PATCH] fix #6139: don't show view containers with hidden views on startup + don't show tree views eagerly Signed-off-by: Anton Kosyakov --- .../src/main/browser/view/plugin-view-registry.ts | 15 +++++++++------ .../src/main/browser/view/tree-views-main.ts | 1 - 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/plugin-ext/src/main/browser/view/plugin-view-registry.ts b/packages/plugin-ext/src/main/browser/view/plugin-view-registry.ts index f20e54684f5f6..383a318b3bfbf 100644 --- a/packages/plugin-ext/src/main/browser/view/plugin-view-registry.ts +++ b/packages/plugin-ext/src/main/browser/view/plugin-view-registry.ts @@ -148,6 +148,13 @@ export class PluginViewRegistry implements FrontendApplicationContribution { } protected async updateViewVisibility(viewId: string): Promise { + const widget = await this.getView(viewId); + if (!widget) { + if (this.isViewVisible(viewId)) { + await this.openView(viewId); + } + return; + } const viewInfo = this.views.get(viewId); if (!viewInfo) { return; @@ -157,10 +164,6 @@ export class PluginViewRegistry implements FrontendApplicationContribution { if (!viewContainer) { return; } - const widget = await this.getView(viewId); - if (!widget) { - return; - } const part = viewContainer.getPartFor(widget); if (!part) { return; @@ -378,8 +381,8 @@ export class PluginViewRegistry implements FrontendApplicationContribution { let viewContainer = await this.getPluginViewContainer(id); if (!viewContainer) { viewContainer = await this.openViewContainer(id); - if (viewContainer && !viewContainer.getTrackableWidgets().length) { - // close empty view containers + if (viewContainer && !viewContainer.getParts().filter(part => !part.isHidden).length) { + // close view containers without any visible view parts viewContainer.dispose(); } } else { diff --git a/packages/plugin-ext/src/main/browser/view/tree-views-main.ts b/packages/plugin-ext/src/main/browser/view/tree-views-main.ts index f0398a1356e55..62fca9cc20005 100644 --- a/packages/plugin-ext/src/main/browser/view/tree-views-main.ts +++ b/packages/plugin-ext/src/main/browser/view/tree-views-main.ts @@ -66,7 +66,6 @@ export class TreeViewsMainImpl implements TreeViewsMain { this.handleTreeEvents(widget.id, widget); return widget; })); - await this.viewRegistry.openView(treeViewId); } async $unregisterTreeDataProvider(treeViewId: string): Promise {