diff --git a/src/vs/workbench/parts/debug/common/debugSource.ts b/src/vs/workbench/parts/debug/common/debugSource.ts index 6347f2eb49ba6..c213d2d601948 100644 --- a/src/vs/workbench/parts/debug/common/debugSource.ts +++ b/src/vs/workbench/parts/debug/common/debugSource.ts @@ -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; } diff --git a/src/vs/workbench/parts/debug/electron-browser/debugService.ts b/src/vs/workbench/parts/debug/electron-browser/debugService.ts index a5570c248e0aa..2c5a5d53c25cc 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugService.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugService.ts @@ -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); }); @@ -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 } } = { };