Skip to content

Commit

Permalink
Wait for debugger capabilities initialization before breakpoint update (
Browse files Browse the repository at this point in the history
  • Loading branch information
vakosta authored Dec 5, 2022
1 parent 1dcddc6 commit 1cc8376
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/debug/src/browser/debug-session.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import { TerminalWidgetOptions, TerminalWidget } from '@theia/terminal/lib/brows
import { DebugFunctionBreakpoint } from './model/debug-function-breakpoint';
import { FileService } from '@theia/filesystem/lib/browser/file-service';
import { DebugContribution } from './debug-contribution';
import { waitForEvent } from '@theia/core/lib/common/promise-util';
import { Deferred, waitForEvent } from '@theia/core/lib/common/promise-util';
import { WorkspaceService } from '@theia/workspace/lib/browser';
import { DebugInstructionBreakpoint } from './model/debug-instruction-breakpoint';

Expand All @@ -53,6 +53,8 @@ export enum DebugState {

// FIXME: make injectable to allow easily inject services
export class DebugSession implements CompositeTreeElement {
protected readonly deferredOnDidConfigureCapabilities = new Deferred<void>();

protected readonly onDidChangeEmitter = new Emitter<void>();
readonly onDidChange: Event<void> = this.onDidChangeEmitter.event;
protected fireDidChange(): void {
Expand Down Expand Up @@ -501,6 +503,7 @@ export class DebugSession implements CompositeTreeElement {

protected updateCapabilities(capabilities: DebugProtocol.Capabilities): void {
Object.assign(this._capabilities, capabilities);
this.deferredOnDidConfigureCapabilities.resolve();
}

protected readonly _breakpoints = new Map<string, DebugBreakpoint[]>();
Expand Down Expand Up @@ -628,6 +631,7 @@ export class DebugSession implements CompositeTreeElement {
return;
}
const { uri, sourceModified } = options;
await this.deferredOnDidConfigureCapabilities.promise;
for (const affectedUri of this.getAffectedUris(uri)) {
if (affectedUri.toString() === BreakpointManager.EXCEPTION_URI.toString()) {
await this.sendExceptionBreakpoints();
Expand Down

0 comments on commit 1cc8376

Please sign in to comment.