VS代码API:如何打开另一个桌面应用程序?

发布于 2025-01-22 15:45:07 字数 713 浏览 2 评论 0原文

我正在使用VS代码的API,我希望当用户单击我已经构建的按钮时打开Slack。

我想出的最好的事情直到此刻就是简单地将按钮指向 https:/app.slack .com/,但我怀疑这是我能做的最好的。

我正在搜索文档,并认为 inther insent命令可以帮助我,但还没有找到一个有用的例子。

我还尝试在我的打字稿文件上执行简单的window.open()而不会成功。

编辑:

我尝试了window.open(“ slack:// open”); and got:

阻止在新窗口中打开'slack:// open',因为请求是在没有设置“允许popups”权限的沙盒框架中制成的。

如果我尝试vscode.open(“ slack:// open”);我获得

属性'open'在type'type'type'type ofimport(“ vscode”)上不存在

I'm using VS Code's API and I want Slack to open when a user clicks a button which I have already built.

The best thing that I've come up with until the moment is to simply point the button to https://app.slack.com/, but I doubt that's the best I can do.

I'm searching through the docs and thought that maybe built-in commands could help me, but haven't found a useful example.

I'm also trying to do a simple window.open() on my TypeScript file with no sucess.

EDIT:

I tried window.open("slack://open"); and got:

Blocked opening 'slack://open' in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.

If I try vscode.open("slack://open"); I get

Property 'open' does not exist on type 'typeof import("vscode")'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文