Define multiple tasks in VSCode

后端 未结 13 2116
旧时难觅i
旧时难觅i 2020-11-28 05:40

I have seen that it is possible to define a task in the VSCode. But I am not sure how to define multiple tasks in the tasks.json file.

13条回答
  •  北荒
    北荒 (楼主)
    2020-11-28 06:08

    This functionality was added in Visual Studio Code v1.9 (January 2017). Example and text come from the release notes:

    {
      "version": "0.1.0",
      "tasks": [
        {
          "taskName": "tsc",
          "command": "tsc",
          "args": ["-w"],
          "isShellCommand": true,
          "isBackground": true,
          "problemMatcher": "$tsc-watch"
        },
        {
          "taskName": "build",
          "command": "gulp",
          "args": ["build"],
          "isShellCommand": true
        }
      ]
    }
    

    Commands per task

    You can now define different commands per task (#981). This allows running different commands for different tasks without writing your own shell script. A tasks.json file using commands per task looks like [the above.]

提交回复
热议问题