我只是探索一种使用Visual Studio Code API开发扩展时打开默认浏览器的方法。
以下是我的代码:
var disposable = vscode.commands.registerCommand('extension.browser', () => {
// The code you place here will be executed every time your command is executed
vscode.Uri.call("http://facebook.com");
});
如何使用vscode类从API打开浏览器URL。
vscode.open
。如果需要这样做,您需要编写一个使用node的child_process
或类似工具的vscode扩展程序。 - Matt Biernervscode.previewHtml
命令 来实现(例如,在 HTML 预览中使用 iframe 加载页面)。 - Matt Biernervscode.env.open
已经更名为vscode.env.openExternal
。 - yumetodomailto:someone@example.com
- Matt Bierner