diff --git a/extensions/grunt/src/main.ts b/extensions/grunt/src/main.ts index 8576b199e63..2b06e1de16b 100644 --- a/extensions/grunt/src/main.ts +++ b/extensions/grunt/src/main.ts @@ -169,16 +169,17 @@ async function getGruntTasks(): Promise { let regExp = /^\s*(\S.*\S) \S/g; let matches = regExp.exec(line); if (matches && matches.length === 2) { - let taskName = matches[1]; + let name = matches[1]; let kind: GruntTaskKind = { type: 'grunt', - task: taskName + task: name }; - let task = taskName.indexOf(' ') === -1 - ? new vscode.Task(kind, taskName, new vscode.ShellExecution(`${command} ${taskName}`)) - : new vscode.Task(kind, taskName, new vscode.ShellExecution(`${command} "${taskName}"`)); + let source = 'grunt'; + let task = name.indexOf(' ') === -1 + ? new vscode.Task(kind, name, source, new vscode.ShellExecution(`${command} ${name}`)) + : new vscode.Task(kind, name, source, new vscode.ShellExecution(`${command} "${name}"`)); result.push(task); - let lowerCaseTaskName = taskName.toLowerCase(); + let lowerCaseTaskName = name.toLowerCase(); if (isBuildTask(lowerCaseTaskName)) { task.group = vscode.TaskGroup.Build; } else if (isTestTask(lowerCaseTaskName)) { diff --git a/extensions/gulp/src/main.ts b/extensions/gulp/src/main.ts index c850de3912c..865880c19ca 100644 --- a/extensions/gulp/src/main.ts +++ b/extensions/gulp/src/main.ts @@ -151,7 +151,7 @@ async function getGulpTasks(): Promise { type: 'gulp', task: line }; - let task = new vscode.Task(kind, line, new vscode.ShellExecution(`${gulpCommand} ${line}`)); + let task = new vscode.Task(kind, line, 'gulp', new vscode.ShellExecution(`${gulpCommand} ${line}`)); result.push(task); let lowerCaseLine = line.toLowerCase(); if (isBuildTask(lowerCaseLine)) { diff --git a/extensions/jake/src/main.ts b/extensions/jake/src/main.ts index 75faf14d461..37f2d795200 100644 --- a/extensions/jake/src/main.ts +++ b/extensions/jake/src/main.ts @@ -155,7 +155,7 @@ async function getJakeTasks(): Promise { type: 'jake', task: taskName }; - let task = new vscode.Task(kind, taskName, new vscode.ShellExecution(`${jakeCommand} ${taskName}`)); + let task = new vscode.Task(kind, taskName, 'jake', new vscode.ShellExecution(`${jakeCommand} ${taskName}`)); result.push(task); let lowerCaseLine = line.toLowerCase(); if (isBuildTask(lowerCaseLine)) { diff --git a/extensions/npm/src/main.ts b/extensions/npm/src/main.ts index d0416ba9951..c7db7206f9d 100644 --- a/extensions/npm/src/main.ts +++ b/extensions/npm/src/main.ts @@ -113,7 +113,7 @@ async function getNpmScriptsAsTasks(): Promise { type: 'npm', script: each }; - const task = new vscode.Task(kind, `run ${each}`, new vscode.ShellExecution(`npm run ${each}`)); + const task = new vscode.Task(kind, `run ${each}`, 'npm', new vscode.ShellExecution(`npm run ${each}`)); const lowerCaseTaskName = each.toLowerCase(); if (isBuildTask(lowerCaseTaskName)) { task.group = vscode.TaskGroup.Build; @@ -123,7 +123,7 @@ async function getNpmScriptsAsTasks(): Promise { result.push(task); }); // add some 'well known' npm tasks - result.push(new vscode.Task({ type: 'npm', script: 'install' } as NpmTaskKind, `install`, new vscode.ShellExecution(`npm install`))); + result.push(new vscode.Task({ type: 'npm', script: 'install' } as NpmTaskKind, `install`, 'npm', new vscode.ShellExecution(`npm install`))); return Promise.resolve(result); } catch (e) { return Promise.resolve(emptyTasks); diff --git a/extensions/typescript/src/features/taskProvider.ts b/extensions/typescript/src/features/taskProvider.ts index 0fa5afd1900..e6a2c8af966 100644 --- a/extensions/typescript/src/features/taskProvider.ts +++ b/extensions/typescript/src/features/taskProvider.ts @@ -54,8 +54,7 @@ class TscTaskProvider implements vscode.TaskProvider { return projects.map(configFile => { const configFileName = path.relative(rootPath, configFile); const identifier: TypeScriptTaskIdentifier = { type: 'typescript', tsconfig: configFileName }; - const buildTask = new vscode.Task(identifier, `build ${configFileName}`, new vscode.ShellExecution(`${command} -p "${configFile}"`), '$tsc'); - buildTask.source = 'tsc'; + const buildTask = new vscode.Task(identifier, `build ${configFileName}`, 'tsc', new vscode.ShellExecution(`${command} -p "${configFile}"`), '$tsc'); buildTask.group = vscode.TaskGroup.Build; return buildTask; }); diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index 2d65428674b..c6c348c1b18 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -250,29 +250,32 @@ declare module 'vscode' { * * @param kind The task kind as defined in the 'taskKinds' extension point. * @param name The task's name. Is presented in the user interface. + * @param source The task's source (e.g. 'gulp', 'npm', ...). Is presented in the user interface. */ - constructor(kind: TaskKind, name: string); + constructor(kind: TaskKind, name: string, source: string); /** * Creates a new task. * * @param kind The task kind as defined in the 'taskKinds' extension point. * @param name The task's name. Is presented in the user interface. + * @param source The task's source (e.g. 'gulp', 'npm', ...). Is presented in the user interface. * @param execution The process or shell execution. */ - constructor(kind: TaskKind, name: string, execution: ProcessExecution | ShellExecution); + constructor(kind: TaskKind, name: string, source: string, execution: ProcessExecution | ShellExecution); /** * Creates a new task. * * @param kind The task kind as defined in the 'taskKinds' extension point. * @param name The task's name. Is presented in the user interface. + * @param source The task's source (e.g. 'gulp', 'npm', ...). Is presented in the user interface. * @param execution The process or shell execution. * @param problemMatchers the names of problem matchers to use, like '$tsc' * or '$eslint'. Problem matchers can be contributed by an extension using * the `problemMatchers` extension point. */ - constructor(kind: TaskKind, name: string, execution: ProcessExecution | ShellExecution, problemMatchers?: string | string[]); + constructor(kind: TaskKind, name: string, source: string, execution: ProcessExecution | ShellExecution, problemMatchers?: string | string[]); /** * The task's kind. diff --git a/src/vs/workbench/api/node/extHostTypes.ts b/src/vs/workbench/api/node/extHostTypes.ts index 61b9ef84b1c..a7e573f6a35 100644 --- a/src/vs/workbench/api/node/extHostTypes.ts +++ b/src/vs/workbench/api/node/extHostTypes.ts @@ -1164,13 +1164,14 @@ export class Task implements vscode.Task { private _presentationOptions: vscode.TaskPresentationOptions; - constructor(kind: vscode.TaskKind, name: string); - constructor(kind: vscode.TaskKind, name: string, execution: ProcessExecution | ShellExecution); - constructor(kind: vscode.TaskKind, name: string, execution: ProcessExecution | ShellExecution, problemMatchers?: string | string[]); + constructor(kind: vscode.TaskKind, name: string, source: string); + constructor(kind: vscode.TaskKind, name: string, source: string, execution: ProcessExecution | ShellExecution); + constructor(kind: vscode.TaskKind, name: string, source: string, execution: ProcessExecution | ShellExecution, problemMatchers?: string | string[]); - constructor(kind: vscode.TaskKind, name: string, execution?: ProcessExecution | ShellExecution, problemMatchers?: string | string[]) { + constructor(kind: vscode.TaskKind, name: string, source: string, execution?: ProcessExecution | ShellExecution, problemMatchers?: string | string[]) { this.kind = kind; this.name = name; + this.source = source; this.execution = execution; if (typeof problemMatchers === 'string') { this._problemMatchers = [problemMatchers];