Skip to content

Commit

Permalink
[debug] Add "debug" progress indicator
Browse files Browse the repository at this point in the history
Fixes #5988

Signed-off-by: Alex Tugarev <[email protected]>
  • Loading branch information
AlexTugarev committed Aug 26, 2019
1 parent f7e0f4c commit 6c4fa9c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/debug/src/browser/debug-session-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;

Expand All @@ -140,10 +143,12 @@ export class DebugSessionManager {

async start(options: DebugSessionOptions): Promise<DebugSession | undefined> {
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.`);
Expand Down
8 changes: 8 additions & 0 deletions packages/debug/src/browser/view/debug-widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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 {
Expand Down

0 comments on commit 6c4fa9c

Please sign in to comment.