Vscode always use sublime, the latter when writing HTML files can be the right mouse button to find open in browser to start the system default browser, and Vscode does not have this function, debugging and preview is more troublesome. However, you can fix this problem by configuring the Tasks.json file.
Press ctrl+p to open the command panel , type Tasks.json and enter to open the file, you can see the default configuration, and then modify the following:
{ //See http://go.microsoft.com/fwlink/?LinkId=733558 //For the documentation about the Tasks.json format"Version": "0.1.0", "Command": "Chrome", // using the Chrome browser "Windows": { "Command": "C:/Program Files (x86)/google/chrome/application/chrome.exe" //The path of the Chrome browser }, "Isshellcommand":true, "Args":["${file}"], // indicates the operation of the current file "Showoutput": "Always"}
After saving open an HTML file, press the key combination ctrl+shift+b You can use the specified browser to open the HTML file.
Use visual Studio code to open a browser to view HTML files