From c52e20f946f6145b8483ef5265122b54b7f1f00b Mon Sep 17 00:00:00 2001 From: Anton Kosyakov Date: Tue, 6 Nov 2018 14:52:01 +0000 Subject: [PATCH] enable the debug view only if there are supported configurations Signed-off-by: Anton Kosyakov --- .../browser/debug-configuration-manager.ts | 15 +++++++++++ ...debug-frontend-application-contribution.ts | 26 +++++++++++-------- ...arch-in-workspace-frontend-contribution.ts | 3 ++- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/packages/debug/src/browser/debug-configuration-manager.ts b/packages/debug/src/browser/debug-configuration-manager.ts index bbae8ae20fc64..d8b9cabbe0e8f 100644 --- a/packages/debug/src/browser/debug-configuration-manager.ts +++ b/packages/debug/src/browser/debug-configuration-manager.ts @@ -100,6 +100,21 @@ export class DebugConfigurationManager { } } + get supported(): Promise> { + return this.getSupported(); + } + protected async getSupported(): Promise> { + const [, debugTypes] = await Promise.all([await this.initialized, this.debug.debugTypes()]); + return this.doGetSupported(new Set(debugTypes)); + } + protected *doGetSupported(debugTypes: Set): IterableIterator { + for (const options of this.getAll()) { + if (debugTypes.has(options.configuration.type)) { + yield options; + } + } + } + protected _currentOptions: DebugSessionOptions | undefined; get current(): DebugSessionOptions | undefined { return this._currentOptions; diff --git a/packages/debug/src/browser/debug-frontend-application-contribution.ts b/packages/debug/src/browser/debug-frontend-application-contribution.ts index 22ee2d416de17..c051bd181daa8 100644 --- a/packages/debug/src/browser/debug-frontend-application-contribution.ts +++ b/packages/debug/src/browser/debug-frontend-application-contribution.ts @@ -275,7 +275,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi protected readonly manager: DebugSessionManager; @inject(DebugConfigurationManager) - protected readonly confiugurations: DebugConfigurationManager; + protected readonly configurations: DebugConfigurationManager; @inject(BreakpointManager) protected readonly breakpointManager: BreakpointManager; @@ -297,7 +297,8 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi widgetId: DebugWidget.ID, widgetName: DebugWidget.LABEL, defaultWidgetOptions: { - area: 'left' + area: 'left', + rank: 400 }, toggleCommandId: 'debug:toggle', toggleKeybinding: 'ctrlcmd+shift+d' @@ -305,7 +306,12 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi } async initializeLayout(): Promise { - await this.openView(); + ((async () => { + const supported = await this.configurations.supported; + if (supported.next().value) { + await this.openView(); + } + })()); } protected firstSessionStart = true; @@ -367,14 +373,12 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi url: launchSchemaUrl.toString() }); }); - await Promise.all([ - this.confiugurations.load(), - this.breakpointManager.load() - ]); + this.configurations.load(); + await this.breakpointManager.load(); } onStop(): void { - this.confiugurations.save(); + this.configurations.save(); this.breakpointManager.save(); } @@ -487,10 +491,10 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi }); registry.registerCommand(DebugCommands.OPEN_CONFIGURATIONS, { - execute: () => this.confiugurations.openConfiguration() + execute: () => this.configurations.openConfiguration() }); registry.registerCommand(DebugCommands.ADD_CONFIGURATION, { - execute: () => this.confiugurations.addConfiguration() + execute: () => this.configurations.addConfiguration() }); registry.registerCommand(DebugCommands.STEP_OVER, { @@ -783,7 +787,7 @@ export class DebugFrontendApplicationContribution extends AbstractViewContributi } async start(noDebug?: boolean): Promise { - let { current } = this.confiugurations; + let { current } = this.configurations; if (current) { if (noDebug !== undefined) { current = { diff --git a/packages/search-in-workspace/src/browser/search-in-workspace-frontend-contribution.ts b/packages/search-in-workspace/src/browser/search-in-workspace-frontend-contribution.ts index 6c45488f3c408..02cde2b34e4a0 100644 --- a/packages/search-in-workspace/src/browser/search-in-workspace-frontend-contribution.ts +++ b/packages/search-in-workspace/src/browser/search-in-workspace-frontend-contribution.ts @@ -53,7 +53,8 @@ export class SearchInWorkspaceFrontendContribution extends AbstractViewContribut widgetId: SearchInWorkspaceWidget.ID, widgetName: SearchInWorkspaceWidget.LABEL, defaultWidgetOptions: { - area: 'left' + area: 'left', + rank: 300 }, toggleCommandId: SearchInWorkspaceCommands.TOGGLE_SIW_WIDGET.id });