Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/devtoolsPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ export class DevToolsPanel {
await ErrorReporter.showErrorDialog({
errorCode: ErrorCodes.Error,
title: 'Error while opening file in editor.',
message: `Could not open document. No workspace mapping was found for '${url}'.`,
message: `Could not open document. No workspace mapping was found for '${url}'. Please configure the 'pathMapping' in your 'launch.json' file.`,
});
}
}
Expand Down Expand Up @@ -491,6 +491,9 @@ export class DevToolsPanel {
}

private async parseUrlToUri(url: string): Promise<vscode.Uri | undefined> {
if (vscode.debug.activeDebugSession) {
console.log(`Original URL: ${url}`);
}
// Convert the devtools url into a local one
let sourcePath = url;
let appendedEntryPoint = false;
Expand All @@ -513,6 +516,10 @@ export class DevToolsPanel {
sourcePath = applyPathMapping(sourcePath, this.config.sourceMapPathOverrides);
}

if (vscode.debug.activeDebugSession) {
console.log(`Source path after entrypoint and source map path overrides: ${sourcePath}`);
}

// Convert the local url to a workspace path
const transformer = new debugCore.UrlPathTransformer();
void transformer.launch({ pathMapping: this.config.pathMapping });
Expand All @@ -522,6 +529,10 @@ export class DevToolsPanel {
const localSource = { path: sourcePath, origin: 'invalid-origin://' };
await transformer.fixSource(localSource);

if (vscode.debug.activeDebugSession) {
console.log(`Local source path after transformation: ${localSource.path}`);
}

// per documentation if the file was correctly resolved origin will be cleared.
// https://github.com/Microsoft/vscode-chrome-debug-core/blob/main/src/transformers/urlPathTransformer.ts
if (!localSource.origin) {
Expand All @@ -535,7 +546,7 @@ export class DevToolsPanel {
await ErrorReporter.showInformationDialog({
errorCode: ErrorCodes.Error,
title: 'Unable to open file in editor.',
message: `${sourcePath} does not map to a local file.${appendedEntryPoint ? entryPointErrorMessage : ''}`,
message: `Could not open '${sourcePath}' in the editor. Make sure that the file is part of the workspace and that 'pathMapping' is configured correctly in your 'launch.json'.${appendedEntryPoint ? entryPointErrorMessage : ''}`,
});
}

Expand Down