"Open webview developer tools" 无法在 VS Code 1.56+ 中工作?
"Open webview developer tools" not working in VS Code 1.56+?
我正在开发一个使用 webview 的 VS Code 扩展。以前我可以使用 Developer: Open webview developer tools
命令检查和调试我的 webview,这将使用 Webview 开发人员工具打开一个新的 window。
但是在 VS Code 1.56 中,此命令不再打开新的 window。发生了什么事以及如何调试我的 webview?
VS Code 1.56 更新了大多数 webview 以使用普通 <iframe>
元素而不是 Electron 的 <webview>
标签。这使您可以使用 VS Code 的标准顶级开发人员工具(可以使用 Developer: Toggle developer tools
命令打开)来调试和检查您的 Web 视图:
这比 Developer: Open webview developer tools
有一些好处:
- 您可以从同一个开发人员工具实例检查多个网络视图
- 当 webview 消失时开发者工具不再关闭
- 来自 webview 的错误和控制台消息清楚地打印在标准开发人员控制台中
警告
在 VS Code 1.56 中,启用搜索的 Webview(使用 .enableFindWidget
)仍然使用 <webview>
标记实现,因此您仍然必须使用 Developer: Open webview developer tools
命令进行调试和检查他们。
我们计划在 1.56
之后的某个时间将所有网络视图迁移为使用 iframe
我正在开发一个使用 webview 的 VS Code 扩展。以前我可以使用 Developer: Open webview developer tools
命令检查和调试我的 webview,这将使用 Webview 开发人员工具打开一个新的 window。
但是在 VS Code 1.56 中,此命令不再打开新的 window。发生了什么事以及如何调试我的 webview?
VS Code 1.56 更新了大多数 webview 以使用普通 <iframe>
元素而不是 Electron 的 <webview>
标签。这使您可以使用 VS Code 的标准顶级开发人员工具(可以使用 Developer: Toggle developer tools
命令打开)来调试和检查您的 Web 视图:
这比 Developer: Open webview developer tools
有一些好处:
- 您可以从同一个开发人员工具实例检查多个网络视图
- 当 webview 消失时开发者工具不再关闭
- 来自 webview 的错误和控制台消息清楚地打印在标准开发人员控制台中
警告
在 VS Code 1.56 中,启用搜索的 Webview(使用 .enableFindWidget
)仍然使用 <webview>
标记实现,因此您仍然必须使用 Developer: Open webview developer tools
命令进行调试和检查他们。
我们计划在 1.56
之后的某个时间将所有网络视图迁移为使用 iframe