如何在 Visual Studio 代码中将默认浏览器设置为 chrome?

How do I set the default browser as chrome in Visual Studio Code?

我是第一次设置我的 VS Code 环境,但我不知道如何将 Chrome 设置为工作区的默认浏览器。

有关浏览器的其他 Whosebug 问题与打开特定文件有关。以下是在全新环境中创建 tasks.json 文件的步骤。

  1. 从“任务”菜单中,Select 'Configure Tasks'
  2. 输入字段提示您输入 'Select a task to configure'
  3. 选择'Create tasks.json file from template'
  4. 编辑文件以包含以下块:

{
            "version": "0.1.0",
            "command": "Chrome",
            "windows": {
                "command": "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
            },
            "args": ["${file}"]
}

修改 tasks.json 的方法不再适用于新版本的 Visual Studio 代码。能够在浏览器中启动代码的最简单方法是从市场安装 Open in Browser 扩展。

安装并重新加载 VS Code 后,您可以转到您的代码并按 A​​LT + B 启动您的应用程序在您的默认浏览器中或 A​​LT + SHIFT + B 到 select 您想要的浏览器使用。

您也可以右键单击并从下拉菜单中 select 这些选项,但我最后提到这一点是因为这目前在某些版本的 VS Code 中不起作用。

转到文件-> 首选项-> 用户设置-> 搜索"By Default it will open your default favorite browser" 设置您的浏览器。

这个替代方法帮助了我:)

GoTo-->Google Chrome-->Settings-->Default browser-->Set Google Chrome as default browser

Chrome可以通过安装debugging your application. Within launch.json, the configurations[].serverReadyAction.action configuration was given a possible value of debugWithChrome in the VS Code February 2019 release. Note that this will also require you have the Debugger for Chrome extension的方式启动。如果未安装扩展程序并且您已将 launch.json 配置为使用 debugWithChrome

,您将不会收到警告

注意:即使您使用 CTRL+F5 启动,使用 debugWithChrome 配置 launch.json 也可以正常工作运行 没有调试的应用程序。

点击设置->输入:默认浏览器->找到:Open-in-browser:Default->输入:GoogleChrome

您可以将计算机中的设置调整为 chrome 中的 open.HTML 文件扩展名作为默认浏览器: 例如在 PC windows:

go to Control Panel > Default programs > Associate a file type or protocol with a specific programs >HTML extension and choose Chrome.

转到设置 -> 扩展 -> 实时服务器配置 -> 更新默认浏览器:

只是 windows 用户的帮手,我刚刚再次安装了 windows 10,我想知道如何设置我的 vscode 以使用 chrome 而不是边缘,因此您只需将 windows 配置为默认使用 google chrome,您无需更改 [=22] 中的任何内容=], 我希望这个帮助ps 某人。

ps: 通常你可以打开你想要默认的浏览器并设置配置。所以在 chrome 中,您必须转到配置并向下滚动到默认浏览器。

Google Chrome > 设置(左侧边栏)> 默认浏览器 = Google Chrome

只需更改 OS 中的默认网络浏览器即可。 在Windows 10,您可以搜索“默认浏览器”,然后会出现更改它的向导。

在 vscode 上搜索 local.testsettings 并进行网络测试,将浏览器更改为 chrome 并申请。

设置中没有为我显示 Live Server 扩展。但是,我安装了“在浏览器中打开”并在设置中输入“liveServer.settings.CustomBrowser”,扩展出现了一个下拉框,我可以在其中更改默认浏览器。

希望对您有所帮助!

这可能是旧的,但我发现了一些有用的东西。

首先转到 Settings/Apps/Default 应用程序。将您的浏览器设置为默认浏览器。

接下来去VSCODE然后去File/Preferences/Settings/Extensions/LiveServerConfig

然后滚动到设置:CustomBrowser 将其更改为您的自定义浏览器

注意 - 如果浏览器未显示在 VSCODE 上,则您需要在设置中将其设置为默认值。