Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run several tasks in VSCode

I am trying to migrate to VSCode and having a problem with setting-up tasks. It is easy to define tasks in tasks.json but I would like to run several tasks simultaneously (which I can't).

Here is my use-case: I have two watchers in my project (one for gulp and another one for webpack). Plus I want to be able to run webpack task separately. When I run one of the watchers I cannot run anything else - VSCode requires me to terminate the running task at first.

In Visual Studio I used Task Runner where several tasks were running simultaneously. Is it possible to achieve the same in VSCode?

like image 481
Kirill Metrik Avatar asked Apr 09 '17 16:04

Kirill Metrik


People also ask

How do you run multiple codes in VS Code?

You can have multiple windows open and they'll each have their own terminal. Or run one in the vscode terminal and one in a regular terminal window. cd project/python && python3 project.py & cd project/node && node . The above runs a python and nodejs project from 1 command.

How do I run VS Code tasks?

Tip: You can run your task through Quick Open (Ctrl+P) by typing 'task', Space and the command name. In this case, 'task lint'.


1 Answers

Using compound tasks, you can specify dependsOn and dependsOrder on a separate task, and run them in parallel like this:

{
  "label": "start-tasks",
  "dependsOrder": "parallel",
  "dependsOn": [
      "taskOne",
      "taskTwo"
  ]
}
like image 84
djolf Avatar answered Oct 22 '22 20:10

djolf