diff --git a/src/vs/workbench/parts/debug/browser/debugContentProvider.ts b/src/vs/workbench/parts/debug/browser/debugContentProvider.ts index ccf2795916f672bcbb2f7c33d3a5a9b1a65d5119..3cd691e11aa308b724a28dbf6c7f2d7e4ff321ab 100644 --- a/src/vs/workbench/parts/debug/browser/debugContentProvider.ts +++ b/src/vs/workbench/parts/debug/browser/debugContentProvider.ts @@ -43,7 +43,7 @@ export class DebugContentProvider implements IWorkbenchContribution, ITextModelC case 'session': process = this.debugService.findProcessByUUID(decodeURIComponent(pair[1])); break; - case 'sourceRef': + case 'ref': sourceRef = parseInt(pair[1]); break; } diff --git a/src/vs/workbench/parts/debug/common/debugModel.ts b/src/vs/workbench/parts/debug/common/debugModel.ts index 6782bbc069c196a107645d7a711daec7888682b0..5471d9b004a3774bd2c34746459811c8627216d8 100644 --- a/src/vs/workbench/parts/debug/common/debugModel.ts +++ b/src/vs/workbench/parts/debug/common/debugModel.ts @@ -459,7 +459,7 @@ export class Thread implements IThread { } return response.body.stackFrames.map((rsf, index) => { - let source = new Source(rsf.source); + let source = new Source(rsf.source, this.process.getId()); if (this.process.sources.has(source.uri.toString())) { source = this.process.sources.get(source.uri.toString()); } else { diff --git a/src/vs/workbench/parts/debug/common/debugSource.ts b/src/vs/workbench/parts/debug/common/debugSource.ts index 4ccf9f55e4325685ea3b4b54baf2acc03c978943..4e8c4681544eae7d52ae63c3f925bd46c884e40e 100644 --- a/src/vs/workbench/parts/debug/common/debugSource.ts +++ b/src/vs/workbench/parts/debug/common/debugSource.ts @@ -11,16 +11,25 @@ const UNKNOWN_SOURCE_LABEL = nls.localize('unknownSource', "Unknown Source"); export class Source { - public uri: uri; + public readonly uri: uri; public available: boolean; - constructor(public raw: DebugProtocol.Source) { + constructor(public readonly raw: DebugProtocol.Source, sessionId?: string) { if (!raw) { this.raw = { name: UNKNOWN_SOURCE_LABEL }; } - const path = this.raw.path || this.raw.name; this.available = this.raw.name !== UNKNOWN_SOURCE_LABEL; - this.uri = this.raw.sourceReference > 0 ? uri.parse(`${DEBUG_SCHEME}:${path}`) : uri.file(path); + const path = this.raw.path || this.raw.name; + if (this.raw.sourceReference > 0) { + let debugUri = `${DEBUG_SCHEME}:${encodeURIComponent(path)}?`; + if (sessionId) { + debugUri += `session=${encodeURIComponent(sessionId)}&`; + } + debugUri += `ref=${this.raw.sourceReference}`; + this.uri = uri.parse(debugUri); + } else { + this.uri = uri.file(path); // path should better be absolute! + } } public get name() { @@ -40,6 +49,6 @@ export class Source { } public get inMemory() { - return this.uri.toString().indexOf(`${DEBUG_SCHEME}:`) === 0; + return this.uri.scheme === DEBUG_SCHEME; } }