Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[debug] Add "debug" progress indicator #6009

Merged
merged 1 commit into from
Aug 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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