Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports vscode-webview-resource: source maps #820

Merged
merged 2 commits into from
Nov 2, 2020

Conversation

eamodio
Copy link
Contributor

@eamodio eamodio commented Oct 28, 2020

Adds source-map support for vscode-webview-resource:// urls from vscode webviews

@eamodio eamodio requested a review from connor4312 October 28, 2020 04:13
@connor4312
Copy link
Member

connor4312 commented Oct 28, 2020

From slack discussion -- webview resource uris take the form

vscode-webview-resource://ac8c06dc-010a-4ea5-bbda-43d6f25dd21c/file///c%3A/Users/Eric/code/eamodio/vscode-gitlens/dist/webviews/rebase.js.map

That uri has file/// instead of file:///. I think this might work by going through got which can normalize it, but this is more incidental than intentional -- I'd prefer we fix up the protocol so this doesn't break in the future.

This is the code in VS Code which handles decoding: https://github.com/microsoft/vscode/blob/ee0aff2460957b825fb4ce2edc3a6d21c90c2c04/src/vs/platform/webview/common/resourceLoader.ts#L104

you can use the standard URL instead of vscode URIs in this case. I would keep the cheap candidate.startsWith('vscode-webview-resource://') check (rather than checking new URL(url).protocol, since passing data URIs in new URL() has caused performance issues.

@connor4312 connor4312 merged commit 0a3bbe9 into master Nov 2, 2020
@connor4312 connor4312 deleted the vscode-webview-resource branch November 2, 2020 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants