Skip to content

Debugging webviews in VS Code #96626

Closed
Closed
@connor4312

Description

@connor4312

Recently several people have asked about wanting to debug the contents webviews in VS Code.

I think is possible if the renderer is launched in debug mode; when debugging VS Code OSS I actually see CDP events for webviews coming down the pipe, e.g

If js-debug was able to attach to the renderer as well, then we should be able to attach to those webviews and debug them natively. There are two things that need to happen for this:

  1. Currently the way extension host debugging works is that we launch VS Code via a custom launchVSCode DAP request, and then we get a subsequent attach request with a port set to the port of the extension host process. We could have a way to request the renderer to be launched in debug mode in the launchVSCode request, and have a rendererPort or something similar in the attach request.
  2. We want to filter so that we don't attach to any extraneous webviews that might be show in the editor. Right now the CDP events I see for the webview are not very useful. The frame is untitled, doesn't provide URLs over the protocol. Eventually we see an "info changed" where it looks like HTML gets set in the document, but it's not something we can filter on easily. It would be helpful if we could fix the URLs, or perhaps title the webview so that we can determine where it's coming from. Here's a log of the CDP events I see today for the notebook renderer webview. cc @mjbvz

/cc @rebornix @eamodio @RMacfarlane as people who have asked for this :)

Metadata

Metadata

Labels

debugDebug viewlet, configurations, breakpoints, adapter issuesfeature-requestRequest for new features or functionalitynotebookon-testplan

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions