Skip to content

Commit

Permalink
debug: introduce breakpoint.idFromAdapter
Browse files Browse the repository at this point in the history
fixes #2013
  • Loading branch information
isidorn committed Feb 10, 2016
1 parent e2e32df commit 9ce9fde
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/vs/workbench/parts/debug/common/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ export interface IBreakpoint extends IEnablement {
desiredLineNumber: number;
condition: string;
verified: boolean;
idFromAdapter: number;
}

export interface IFunctionBreakpoint extends IEnablement {
name: string;
verified: boolean;
idFromAdapter: number;
}

export interface IExceptionBreakpoint extends IEnablement {
Expand Down
6 changes: 5 additions & 1 deletion src/vs/workbench/parts/debug/common/debugModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ export class Breakpoint implements debug.IBreakpoint {

public lineNumber: number;
public verified: boolean;
public idFromAdapter: number;
private id: string;

constructor(public source: Source, public desiredLineNumber: number, public enabled: boolean, public condition: string) {
Expand All @@ -302,6 +303,7 @@ export class FunctionBreakpoint implements debug.IFunctionBreakpoint {

private id: string;
public verified: boolean;
public idFromAdapter: number;

constructor(public name: string, public enabled: boolean) {
this.verified = false;
Expand Down Expand Up @@ -412,6 +414,7 @@ export class Model extends ee.EventEmitter implements debug.IModel {
if (bpData) {
bp.lineNumber = bpData.line;
bp.verified = bpData.verified;
bp.idFromAdapter = bpData.id;
}
});
this.emit(debug.ModelEvents.BREAKPOINTS_UPDATED);
Expand Down Expand Up @@ -447,12 +450,13 @@ export class Model extends ee.EventEmitter implements debug.IModel {
this.emit(debug.ModelEvents.BREAKPOINTS_UPDATED);
}

public updateFunctionBreakpoints(data: { [id: string]: { name?: string, verified?: boolean } }): void {
public updateFunctionBreakpoints(data: { [id: string]: { name?: string, verified?: boolean; id?: number } }): void {
this.functionBreakpoints.forEach(fbp => {
const fbpData = data[fbp.getId()];
if (fbpData) {
fbp.name = fbpData.name || fbp.name;
fbp.verified = fbpData.verified;
fbp.idFromAdapter = fbpData.id;
}
});

Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/parts/debug/electron-browser/debugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,11 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService

this.toDispose.push(this.session.addListener2(debug.SessionEvents.BREAKPOINT, (event: DebugProtocol.BreakpointEvent) => {
const id = event.body && event.body.breakpoint ? event.body.breakpoint.id : undefined;
const breakpoint = this.model.getBreakpoints().filter(bp => bp.getId() === <any>id).pop();
const breakpoint = this.model.getBreakpoints().filter(bp => bp.idFromAdapter === id).pop();
if (breakpoint) {
this.model.updateBreakpoints({ [breakpoint.getId()]: event.body.breakpoint });
} else {
const functionBreakpoint = this.model.getFunctionBreakpoints().filter(bp => bp.getId() === <any>id).pop();
const functionBreakpoint = this.model.getFunctionBreakpoints().filter(bp => bp.idFromAdapter === id).pop();
if (functionBreakpoint) {
this.model.updateFunctionBreakpoints({ [functionBreakpoint.getId()]: event.body.breakpoint });
}
Expand Down

0 comments on commit 9ce9fde

Please sign in to comment.