How do I set the default browser as chrome in Visu

2019-04-20 10:27发布

问题:

I am setting up my VS Code environment for the first time, but I can't figure out how to set Chrome as the default browser for the workspace.

回答1:

The other StackOverflow questions regarding the browser, had to do with opening a specific file. Here are the steps to creating a tasks.json file in a brand new environment.

  1. From the Tasks menu, Select 'Configure Tasks'
  2. The entry field prompts you for 'Select a task to configure'
  3. Choose 'Create tasks.json file from template'
  4. Edit the file to include the following block:

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


回答2:

The method of modifying tasks.json no longer works in newer versions of Visual Studio Code. The easiest way to be able to launch your code in a browser is to install the Open in Browser extension from the marketplace.

After it is installed and VS Code is reloaded, you can go to your code and press ALT + B to launch your application in your default browser or ALT + SHIFT + B to select the browser you want to use.

You can also right click and select these option from a drop down menu, but I mention this last because this currently does not work in some versions of VS Code.



回答3:

Go to file-> preferences -> user settings -> search "By Default it will open your default favorite browser" set your browser.