0

Looks like an old question, but no proper answers found. I've looked at here and here. Right now, I can open Chrome by doing this:

task.json:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "taskName": "echo",
            "type": "shell",
            "command": "echo Hello"
        },
        {
            "taskName": "Open in Chrome",
            // "type": "process",
            "windows": {
                "command": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
            },
            "args": ["${file}"],
        }
    ]
}

keybindings.json:

[{
        "key": "ctrl+alt+g",
        "command": "workbench.action.tasks.runTask",
        "args": "Open in Chrome"
 },]

Note that I don't even need type: process to make it run and can only run it using my own key binding. If I use ctrl+shift+B (Windows), it'll allow one task only.

However, every time I run the task, the terminal is also opened with: Terminal will be reused by tasks, press any key to close it. which is repetitive and not really helpful for front-end work.

Is there a way to turn that off?

I've tried adding:

"presentation": {
                "reveal": "never" //same with "silent"
            }

to the task in task.json but it doesn't work.

Viet
  • 6,513
  • 12
  • 42
  • 74
  • Did you try either "panel": "shared" or "panel": "dedicated" to see if it helps with that message? See https://code.visualstudio.com/docs/editor/tasks#_output-behavior – Mark Oct 20 '17 at 00:53
  • @Mark thanks for your suggestions. panel: shared still opens the terminal like mentioned above. panel: dedicated doesn't show the page, it shows the task.json file on the browser. – Viet Oct 20 '17 at 12:09

1 Answers1

0

Answer to close question: The easiest way is to use an extension like this one: https://marketplace.visualstudio.com/items?itemName=techer.open-in-browser

Viet
  • 6,513
  • 12
  • 42
  • 74