简体   繁体   中英

"Open webview developer tools" not working in VS Code 1.56+?

I'm developing a VS Code extension that uses a webview . Previously I could inspect and debug my webview using the Developer: Open webview developer tools command, which would open a new window with the Webview developer tools.

In VS Code 1.56 however, this command no longer opens a new window. What's going on and how can I debug my webview?

VS Code 1.56 updates the majority of webviews to use normal <iframe> elements instead of Electron's <webview> tag. This lets you use VS Code's standard, top-level developer tools ( which can be opened with the Developer: Toggle developer tools command) to debug and inspect your webviews:

在 VS Code 的开发者工具中检查 webview

This has a few benefits over Developer: Open webview developer tools :

  • You can inspect multiple webviews from the same developer tools instance
  • The developer tools no longer close when the webview goes away
  • Errors and console messages from webviews are clearly printed in the standard developer console

Caveat

In VS Code 1.56, Webviews that enable search (with .enableFindWidget ) are still implemented using a <webview> tag, so you must still use the Developer: Open webview developer tools command to debug and inspect them.

We plan on migrating all webviews to use iframes sometime after 1.56

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM