From 6c4fa9c7ff074ec9a028ae552ec096d6057ea9fd Mon Sep 17 00:00:00 2001 From: Alex Tugarev Date: Wed, 21 Aug 2019 16:42:53 +0200 Subject: [PATCH] [debug] Add "debug" progress indicator Fixes #5988 Signed-off-by: Alex Tugarev --- .../debug/src/browser/debug-session-manager.ts | 15 ++++++++++----- packages/debug/src/browser/view/debug-widget.ts | 8 ++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/debug/src/browser/debug-session-manager.ts b/packages/debug/src/browser/debug-session-manager.ts index 1bfa298b6540f..3d9c7c1c7b40f 100644 --- a/packages/debug/src/browser/debug-session-manager.ts +++ b/packages/debug/src/browser/debug-session-manager.ts @@ -17,7 +17,7 @@ // tslint:disable:no-any import { injectable, inject, postConstruct } from 'inversify'; -import { Emitter, Event, DisposableCollection, MessageService, WaitUntilEvent } from '@theia/core'; +import { Emitter, Event, DisposableCollection, MessageService, WaitUntilEvent, ProgressService } from '@theia/core'; import { LabelProvider } from '@theia/core/lib/browser'; import { EditorManager } from '@theia/editor/lib/browser'; import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service'; @@ -121,6 +121,9 @@ export class DebugSessionManager { @inject(MessageService) protected readonly messageService: MessageService; + @inject(ProgressService) + protected readonly progressService: ProgressService; + @inject(ContextKeyService) protected readonly contextKeyService: ContextKeyService; @@ -140,10 +143,12 @@ export class DebugSessionManager { async start(options: DebugSessionOptions): Promise { try { - await this.fireWillStartDebugSession(); - const resolved = await this.resolveConfiguration(options); - const sessionId = await this.debug.createDebugSession(resolved.configuration); - return this.doStart(sessionId, resolved); + return this.progressService.withProgress('Start...', 'debug', async () => { + await this.fireWillStartDebugSession(); + const resolved = await this.resolveConfiguration(options); + const sessionId = await this.debug.createDebugSession(resolved.configuration); + return this.doStart(sessionId, resolved); + }); } catch (e) { if (DebugError.NotFound.is(e)) { this.messageService.error(`The debug session type "${e.data.type}" is not supported.`); diff --git a/packages/debug/src/browser/view/debug-widget.ts b/packages/debug/src/browser/view/debug-widget.ts index c8147560b60b8..4845d0c450c29 100644 --- a/packages/debug/src/browser/view/debug-widget.ts +++ b/packages/debug/src/browser/view/debug-widget.ts @@ -22,6 +22,8 @@ import { DebugSessionWidget } from './debug-session-widget'; import { DebugConfigurationWidget } from './debug-configuration-widget'; import { DebugViewModel } from './debug-view-model'; import { DebugSessionManager } from '../debug-session-manager'; +import { ProgressLocationService } from '@theia/core/lib/browser/progress-location-service'; +import { ProgressBar } from '@theia/core/lib/browser/progress-bar'; @injectable() export class DebugWidget extends BaseWidget implements StatefulWidget, ApplicationShell.TrackableWidgetProvider { @@ -51,6 +53,9 @@ export class DebugWidget extends BaseWidget implements StatefulWidget, Applicati @inject(DebugSessionWidget) protected readonly sessionWidget: DebugSessionWidget; + @inject(ProgressLocationService) + protected readonly progressLocationService: ProgressLocationService; + @postConstruct() protected init(): void { this.id = DebugWidget.ID; @@ -72,6 +77,9 @@ export class DebugWidget extends BaseWidget implements StatefulWidget, Applicati const layout = this.layout = new PanelLayout(); layout.addWidget(this.toolbar); layout.addWidget(this.sessionWidget); + + const onProgress = this.progressLocationService.onProgress('debug'); + this.toDispose.push(new ProgressBar({ container: this.node, insertMode: 'prepend' }, onProgress)); } protected onActivateRequest(msg: Message): void {