mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 01:58:53 +01:00
proposed API for creating debug uri
This commit is contained in:
@@ -138,6 +138,32 @@ export class ExtHostDebugService implements IExtHostDebugService, ExtHostDebugSe
|
||||
});
|
||||
}
|
||||
|
||||
public asDebugSourceUri(src: vscode.DebugSource, session?: vscode.DebugSession): URI {
|
||||
|
||||
const source = <any>src;
|
||||
|
||||
if (typeof source.sourceReference === 'number') {
|
||||
// src can be retrieved via DAP's "source" request
|
||||
|
||||
let debug = `debug:${encodeURIComponent(source.path || '')}`;
|
||||
let sep = '?';
|
||||
|
||||
if (session) {
|
||||
debug += `${sep}session=${encodeURIComponent(session.id)}`;
|
||||
sep = '&';
|
||||
}
|
||||
|
||||
debug += `${sep}ref=${source.sourceReference}`;
|
||||
|
||||
return vscode.Uri.parse(debug);
|
||||
} else if (source.path) {
|
||||
// src is just a local file path
|
||||
return vscode.Uri.file(source.path);
|
||||
} else {
|
||||
throw new Error(`cannot create uri from DAP 'source' object; properties 'path' and 'sourceReference' are both missing.`);
|
||||
}
|
||||
}
|
||||
|
||||
private registerAllDebugTypes(extensionRegistry: ExtensionDescriptionRegistry) {
|
||||
|
||||
const debugTypes: string[] = [];
|
||||
|
||||
Reference in New Issue
Block a user