Define multiple tasks in VSCode

后端 未结 13 1975
旧时难觅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:02

    As of the February 2017 release, you can use Terminal Runner and compose multiple tasks by setting up dependency tasks. It's a little funky in that it will open up a separate integrated terminal for each task, which you have to watch to see if things work and remember to close (they "stack"), and you don't get a "done" notification, but it gets the job done. The functionality is preliminary but it is promising. Here's is an example to run tsc and jspm for a Cordova app.

    {
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [{
            "taskName": "tsc",
            "command": "tsc",
            "isShellCommand": true,
            "args": ["-p", "."],
            "showOutput": "always",
            "problemMatcher": "$tsc"
        }, {
            "taskName": "jspm",
            "command": "jspm",
            "isShellCommand": true,
            "args": ["bundle-sfx", "www/app/main.js", "www/dist/bundle.js", "--inline-source-maps", "--source-map-contents"],
            "showOutput": "always"
        },
        {
            "taskName": "build",
            "isBuildCommand": true,
            "dependsOn": ["tsc", "jspm"]
        }]
    }
    

提交回复
热议问题