Joe Zim
Joe Zim

Reputation: 1987

Launching Multiple Simultaneous Tasks in VS Code

I have a single "project" with 3 separate codebases (loaded into a single workspace), each of which has its own long-running npm start task. I want to run all of these at the same time. This isn't too hard if you just go to Terminal -> Run Task 3 times and launch each individually, but since I do this every day and sometimes multiple times per day, it'd be nice to simplify it into running a single command that launches all 3 at once, preferrably in a split terminal (though not necessary), rather than each having their own tab. Anyone know if this is possible?

Upvotes: 0

Views: 256

Answers (1)

Sean Oliver
Sean Oliver

Reputation: 26

What you want to do is make a new separate task and list the 3 tasks you want to run as dependancies. For example, in your tasks.json:

{
"version": "2.0.0",
"tasks": [
    {
        "label": "Task1",
        // ...
    },
    {
        "label": "Task2",
        // ...
    },
    {
        "label": "Task3",
        // ...
    },
    {
        "label": "Run 3 Tasks",
        "dependsOn": ["Task1", "Task2", "Task3"]
    }
]
}

The default behavior for dependancies will be to run tasks in parellel. This can be changed with the dependsOrder tag. https://code.visualstudio.com/Docs/editor/tasks

Upvotes: 1

Related Questions