提交 f41ef8c2 编写于 作者: A Andre Weinand

make debug URIs robust; fixes #23194

上级 e6874a38
......@@ -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;
}
......
......@@ -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 {
......
......@@ -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;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册