Skip to content

Commit

Permalink
debug: fix persisting and sending stored internal module data
Browse files Browse the repository at this point in the history
fixes #1793
  • Loading branch information
isidorn committed Jan 8, 2016
1 parent 54e050e commit 105fb54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/vs/workbench/parts/debug/common/debugSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class Source {

private static INTERNAL_URI_PREFIX = 'debug://internal/';

constructor(private raw: DebugProtocol.Source) {
constructor(public raw: DebugProtocol.Source) {
this.uri = raw.path ? uri.file(raw.path) : uri.parse(Source.INTERNAL_URI_PREFIX + raw.name);
this.available = true;
}
Expand Down
14 changes: 7 additions & 7 deletions src/vs/workbench/parts/debug/electron-browser/debugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
private loadBreakpoints(): debug.IBreakpoint[] {
try {
return JSON.parse(this.storageService.get(DEBUG_BREAKPOINTS_KEY, StorageScope.WORKSPACE, '[]')).map((breakpoint: any) => {
// Source reference changes across sessions, so we do not use it to persist the source.
delete breakpoint.source.raw.sourceReference;
return new model.Breakpoint(new Source(breakpoint.source.raw ? breakpoint.source.raw : { path: uri.parse(breakpoint.source.uri).fsPath, name: breakpoint.source.name }),
breakpoint.desiredLineNumber || breakpoint.lineNumber, breakpoint.enabled, breakpoint.condition);
});
Expand Down Expand Up @@ -779,17 +781,15 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
}

private sendBreakpoints(modelUri: uri): Promise {
if (!this.session || !this.session.readyForBreakpoints) {
return Promise.as(null);
}

const breakpointsToSend = arrays.distinct(
this.model.getBreakpoints().filter(bp => this.model.areBreakpointsActivated() && bp.enabled && bp.source.uri.toString() === modelUri.toString()),
bp => `${ bp.desiredLineNumber }`
bp => `${ bp.desiredLineNumber }`
);
if (!this.session || !this.session.readyForBreakpoints || breakpointsToSend.length === 0) {
return Promise.as(null);
}


return this.session.setBreakpoints({ source: Source.toRawSource(modelUri, this.model), lines: breakpointsToSend.map(bp => bp.desiredLineNumber),
return this.session.setBreakpoints({ source: breakpointsToSend[0].source.raw, lines: breakpointsToSend.map(bp => bp.desiredLineNumber),
breakpoints: breakpointsToSend.map(bp => ({ line: bp.desiredLineNumber, condition: bp.condition })) }).then(response => {

const data: {[id: string]: { line: number, verified: boolean } } = { };
Expand Down

0 comments on commit 105fb54

Please sign in to comment.