44 *--------------------------------------------------------------------------------------------*/
55
66import {
7- TaskDefinition , Task , TaskGroup , WorkspaceFolder , RelativePattern , ShellExecution , Uri , workspace ,
7+ TaskDefinition , Task2 as Task , TaskGroup , WorkspaceFolder , RelativePattern , ShellExecution , Uri , workspace ,
88 DebugConfiguration , debug , TaskProvider , TextDocument , tasks , TaskScope , QuickPickItem
99} from 'vscode' ;
1010import * as path from 'path' ;
@@ -237,7 +237,7 @@ async function provideNpmScriptsForFolder(packageJsonUri: Uri): Promise<Task[]>
237237
238238 const prePostScripts = getPrePostScripts ( scripts ) ;
239239 Object . keys ( scripts ) . forEach ( each => {
240- const task = createTask ( each , `run ${ each } ` , folder ! , packageJsonUri ) ;
240+ const task = createTask ( each , `run ${ each } ` , folder ! , packageJsonUri , scripts ! [ each ] ) ;
241241 const lowerCaseTaskName = each . toLowerCase ( ) ;
242242 if ( isBuildTask ( lowerCaseTaskName ) ) {
243243 task . group = TaskGroup . Build ;
@@ -253,7 +253,7 @@ async function provideNpmScriptsForFolder(packageJsonUri: Uri): Promise<Task[]>
253253 result . push ( task ) ;
254254 } ) ;
255255 // always add npm install (without a problem matcher)
256- result . push ( createTask ( 'install' , 'install' , folder , packageJsonUri , [ ] ) ) ;
256+ result . push ( createTask ( 'install' , 'install' , folder , packageJsonUri , undefined , [ ] ) ) ;
257257 return result ;
258258}
259259
@@ -264,7 +264,7 @@ export function getTaskName(script: string, relativePath: string | undefined) {
264264 return script ;
265265}
266266
267- export function createTask ( script : NpmTaskDefinition | string , cmd : string , folder : WorkspaceFolder , packageJsonUri : Uri , matcher ?: any ) : Task {
267+ export function createTask ( script : NpmTaskDefinition | string , cmd : string , folder : WorkspaceFolder , packageJsonUri : Uri , detail ?: string , matcher ?: any ) : Task {
268268 let kind : NpmTaskDefinition ;
269269 if ( typeof script === 'string' ) {
270270 kind = { type : 'npm' , script : script } ;
@@ -292,7 +292,9 @@ export function createTask(script: NpmTaskDefinition | string, cmd: string, fold
292292 }
293293 let taskName = getTaskName ( kind . script , relativePackageJson ) ;
294294 let cwd = path . dirname ( packageJsonUri . fsPath ) ;
295- return new Task ( kind , folder , taskName , 'npm' , new ShellExecution ( getCommandLine ( folder , cmd ) , { cwd : cwd } ) , matcher ) ;
295+ const task = new Task ( kind , folder , taskName , 'npm' , new ShellExecution ( getCommandLine ( folder , cmd ) , { cwd : cwd } ) , matcher ) ;
296+ task . detail = detail ;
297+ return task ;
296298}
297299
298300
0 commit comments