Anyone been using Visual Studio Code know if there is a way to right click and open in default browser (a la Sublime Text)? I know you can right click on the file node and "reveal in explorer" and then manually open it in a browser... but I want to save that extra 2 secs.
Actually both the above code opens windows file explorer not BROWSER.
I am using following code which works perfectly, opens file in Chrome, while testing a static html file with Javascript.
{
"version": "0.1.0",
"command": "Chrome",
"windows": {
"command": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
},
"args": ["${file}"]
}
I've got something similar in one of my projects. I've set up my tasks.json as shown below. With that in place I can type "Ctrl+P then type "task start" and hit enter to load the current HTML file in the default browser :-)
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process
{
"version": "0.1.0",
"command": "powershell",
"isShellCommand": true,
"suppressTaskName": true,
"tasks": [
// other tasks here,
{
"taskName": "start browser",
"args": [
"start", "${file}"
]
}
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With