debug: fix persisting and sending stored internal module data
fixes #1793
This commit is contained in:
parent
54e050ef61
commit
105fb54c14
2 changed files with 9 additions and 9 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
const breakpointsToSend = arrays.distinct(
|
||||
this.model.getBreakpoints().filter(bp => this.model.areBreakpointsActivated() && bp.enabled && bp.source.uri.toString() === modelUri.toString()),
|
||||
bp => `${ bp.desiredLineNumber }`
|
||||
);
|
||||
if (!this.session || !this.session.readyForBreakpoints || breakpointsToSend.length === 0) {
|
||||
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 }`
|
||||
);
|
||||
|
||||
|
||||
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 } } = { };
|
||||
|
|
Loading…
Reference in a new issue