2017-09-05 100 views
0

是否可以从VSCode中的任务运行任务?VScode中的任务

例JSON:

{ 
// See https://go.microsoft.com/fwlink/?LinkId=733558 
// for the documentation about the tasks.json format 
"version": "2.0.0", 
"tasks": [ 
    { 
     "taskName": "Show In Chrome", 
     "windows": { 
      "command": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" 
     }, 
     "osx": { 
      "command": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" 
     }, 
     "args": [ 
      "${file}" 
     ], 
     "type": "process", 
    }, 
    { 
     "taskName": "Show Coverage", 
     // this is the task to call another task 
    } 
] 

}

我想要做的是有显示覆盖任务,寻找在覆盖文件夹中的文件,然后拨打显示在Chrome的任务,它显示为该文件的参数被传递。这可能吗?

+0

我不明白这个评论。 – KeniSteward

回答

0

事实证明,文档网站的当前配置不会更新任务。

但是,如果你想有一个任务来调用其他的任务,因为它依赖于他们,你可以简单地添加该配置

{ 
// See https://go.microsoft.com/fwlink/?LinkId=733558 
// for the documentation about the tasks.json format 
"version": "2.0.0", 
"tasks": [ 
    { 
     "taskName": "Show In Chrome", 
     "identifier": "showInChrome", 
     "windows": { 
      "command": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" 
     }, 
     "osx": { 
      "command": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" 
     }, 
     "args": [ 
      "${file}" 
     ], 
     "type": "process", 
    }, 
    { 
     "taskName": "Show Coverage", 
     "dependsOn": "showInChrome" 
    } 
] 
} 

这将导致任务运行的前一个任务,然后运行任何命令,它已成立以及。

注意:您可以使用多个依赖通过使用一个标识符数组。