简体   繁体   English

Visual Studio Code web 扩展能否依赖于其他扩展?

[英]Can a Visual Studio Code web extension be dependent on other extensions?

I am trying to develop a Web extension for VS code.我正在尝试为 VS 代码开发 Web 扩展。 It is dependent on other VS Code extensions.它依赖于其他 VS Code 扩展。 In the package.json file, I define the extensionDependencies field to include the unique id of the extension the web extension depends on.package.json文件中,我定义了extensionDependencies字段以包含 web 扩展所依赖的扩展的唯一 ID。

I cannot correctly configure my extension to depend on ANY other extension.我无法正确配置我的扩展以依赖任何其他扩展。 For example, I tried to add the unique id for the Prettier - Code Formatter extension, which works on the web, to my extensionDependencies field.例如,我尝试将适用于 web 的 Prettier - Code Formatter扩展的唯一 ID 添加到我的extensionDependencies字段中。 When running my web extension in the debugger, I get the error "Cannot activate the 'myextensionname' extension because it depends on the 'Prettier - Code formatter' extension, which is not loaded. Would you like to reload the window to load the extension?"在调试器中运行我的 web 扩展时,我收到错误“无法激活 'myextensionname' 扩展,因为它依赖于未加载的 'Prettier - Code formatter' 扩展。您想重新加载 window 以加载扩展?”

Reloading does nothing.重新加载什么都不做。 Please let me know if any of you have experience working with web extensions and have worked through this problem before.如果你们中的任何人有使用 web 扩展的经验并且之前解决过这个问题,请告诉我。

Solved.解决了。 Feel very silly but you need to test in an actual browser to get the correct behavior.感觉很傻,但您需要在实际浏览器中进行测试才能获得正确的行为。 The web extensions docs page does a good job explaining how to do this. web 扩展文档页面很好地解释了如何执行此操作。 Testing from the VS Code debugger on desktop will not work.从桌面上的 VS Code 调试器进行测试将不起作用。 Leaving this up in case others run into this issue.留下这个,以防其他人遇到这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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