diff --git a/src/vs/workbench/parts/tasks/common/taskConfiguration.ts b/src/vs/workbench/parts/tasks/common/taskConfiguration.ts index 2419be66ba092d15a30f4e8c7a8810ecd974197e..717fa268eab9957b5d2092daf1195eaec98802c7 100644 --- a/src/vs/workbench/parts/tasks/common/taskConfiguration.ts +++ b/src/vs/workbench/parts/tasks/common/taskConfiguration.ts @@ -105,6 +105,11 @@ export interface TaskDescription extends PlatformTaskDescription { */ identifier?: string; + /** + * The id of the customized task + */ + customize?: string; + /** * Windows specific task configuration */ @@ -903,6 +908,9 @@ namespace TaskDescription { task.group = Tasks.TaskGroup.Test; } } + if (Types.isString(externalTask.customize)) { + task.customize = externalTask.customize; + } if (externalTask.command !== void 0) { // if the task has its own command then we suppress the // task name by default. @@ -1055,7 +1063,7 @@ namespace TaskDescription { } function isAnnotating(task: Tasks.Task): boolean { - return (task.command === void 0 || task.command.name === void 0) && (task.dependsOn === void 0 || task.dependsOn.length === 0); + return task.customize !== void 0 && (task.command === void 0 || task.command.name === void 0); } export function assignProperties(target: Tasks.Task, source: Tasks.Task): Tasks.Task { diff --git a/src/vs/workbench/parts/tasks/common/tasks.ts b/src/vs/workbench/parts/tasks/common/tasks.ts index 88dfd56ba739c755a733393c87f6a3f5f03c4b15..b75a5750e58866aee91a822159737e94ecec435f 100644 --- a/src/vs/workbench/parts/tasks/common/tasks.ts +++ b/src/vs/workbench/parts/tasks/common/tasks.ts @@ -208,6 +208,11 @@ export interface Task { */ identifier: string; + /** + * The id of the customized task + */ + customize?: string; + /** * the task's group; */ diff --git a/src/vs/workbench/parts/tasks/electron-browser/jsonSchema_v2.ts b/src/vs/workbench/parts/tasks/electron-browser/jsonSchema_v2.ts index 3a60d35d08892b264448a3268eacabee7bec1067..14985496e1815b03b5d993fe542d08e6c3ac1b15 100644 --- a/src/vs/workbench/parts/tasks/electron-browser/jsonSchema_v2.ts +++ b/src/vs/workbench/parts/tasks/electron-browser/jsonSchema_v2.ts @@ -83,9 +83,9 @@ const version: IJSONSchema = { description: nls.localize('JsonSchema.version', 'The config\'s version number.') }; -const identifier: IJSONSchema = { +const customize: IJSONSchema = { type: 'string', - description: nls.localize('JsonSchema.tasks.identifier', 'A unique identifier of the task.') + description: nls.localize('JsonSchema.tasks.customize', 'The contributed task to be customized.') }; const schema: IJSONSchema = { @@ -128,7 +128,7 @@ definitions.taskDescription.properties.dependsOn = dependsOn; // definitions.taskDescription.properties.echoCommand.deprecationMessage = nls.localize('JsonSchema.tasks.echoCommand.deprecated', 'The property echoCommand is deprecated. Use the terminal property instead.'); // definitions.taskDescription.properties.isBuildCommand.deprecationMessage = nls.localize('JsonSchema.tasks.isBuildCommand.deprecated', 'The property isBuildCommand is deprecated. Use the group property instead.'); // definitions.taskDescription.properties.isTestCommand.deprecationMessage = nls.localize('JsonSchema.tasks.isTestCommand.deprecated', 'The property isTestCommand is deprecated. Use the group property instead.'); -definitions.taskDescription.properties.identifier = identifier; +definitions.taskDescription.properties.customize = customize; definitions.taskDescription.properties.type = Objects.deepClone(taskType); definitions.taskDescription.properties.terminal = terminal; definitions.taskDescription.properties.group = group; diff --git a/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts b/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts index f14e2e4bbc6c42cfd630a95973d688ccba8c1cb5..126ca11a1b8d86e02d02d8e5c4e9e9dca95d096f 100644 --- a/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts +++ b/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts @@ -71,7 +71,7 @@ import { Scope, IActionBarRegistry, Extensions as ActionBarExtensions } from 'vs import { ITerminalService } from 'vs/workbench/parts/terminal/common/terminal'; import { ITaskSystem, ITaskResolver, ITaskSummary, ITaskExecuteResult, TaskExecuteKind, TaskError, TaskErrors, TaskSystemEvents } from 'vs/workbench/parts/tasks/common/taskSystem'; -import { Task, TaskSet, TaskGroup, ExecutionEngine, TaskSourceKind } from 'vs/workbench/parts/tasks/common/tasks'; +import { Task, TaskSet, TaskGroup, ExecutionEngine, JsonSchemaVersion, TaskSourceKind } from 'vs/workbench/parts/tasks/common/tasks'; import { ITaskService, TaskServiceEvents, ITaskProvider } from 'vs/workbench/parts/tasks/common/taskService'; import { templates as taskTemplates } from 'vs/workbench/parts/tasks/common/taskTemplates'; @@ -502,7 +502,6 @@ interface WorkspaceTaskResult { set: TaskSet; annotatingTasks: { byIdentifier: IStringDictionary; - byLabel: IStringDictionary; }; hasErrors: boolean; } @@ -756,7 +755,7 @@ class TaskService extends EventEmitter implements ITaskService { return TPromise.as(undefined); } let fileConfig = configuration.config; - let customize = { taskName: task._label, identifier: task.identifier }; + let customize = { customize: task.identifier, taskName: task._label, problemMatcher: [] }; if (!fileConfig) { fileConfig = { version: '2.0.0', @@ -952,7 +951,7 @@ class TaskService extends EventEmitter implements ITaskService { resolve(result); } }; - if (this.getExecutionEngine() === ExecutionEngine.Terminal && this._providers.size > 0) { + if (this.getJsonSchemaVersion() === JsonSchemaVersion.V2_0_0 && this._providers.size > 0) { this._providers.forEach((provider) => { counter++; provider.provideTasks().done(done, error); @@ -970,7 +969,7 @@ class TaskService extends EventEmitter implements ITaskService { for (let set of result) { for (let task of set.tasks) { if (annotatingTasks) { - let annotatingTask = annotatingTasks.byIdentifier[task.identifier] || annotatingTasks.byLabel[task._label]; + let annotatingTask = annotatingTasks.byIdentifier[task.identifier]; if (annotatingTask) { TaskConfig.mergeTasks(task, annotatingTask); task.name = annotatingTask.name; @@ -1123,17 +1122,13 @@ class TaskService extends EventEmitter implements ITaskService { problemReporter.fatal(nls.localize('TaskSystem.configurationErrors', 'Error: the provided task configuration has validation errors and can\'t not be used. Please correct the errors first.')); return { set: undefined, annotatingTasks: undefined, hasErrors }; } - let annotatingTasks: { byIdentifier: IStringDictionary; byLabel: IStringDictionary; }; + let annotatingTasks: { byIdentifier: IStringDictionary; }; if (parseResult.annotatingTasks && parseResult.annotatingTasks.length > 0) { annotatingTasks = { - byIdentifier: Object.create(null), - byLabel: Object.create(null) + byIdentifier: Object.create(null) }; for (let task of parseResult.annotatingTasks) { - annotatingTasks.byIdentifier[task.identifier] = task; - if (task._label) { - annotatingTasks.byLabel[task._label] = task; - } + annotatingTasks.byIdentifier[task.customize] = task; } } return { set: { tasks: parseResult.tasks }, annotatingTasks: annotatingTasks, hasErrors }; @@ -1149,7 +1144,6 @@ class TaskService extends EventEmitter implements ITaskService { return TaskConfig.ExecutionEngine.from(config); } - /* private getJsonSchemaVersion(): JsonSchemaVersion { let { config } = this.getConfiguration(); if (!config) { @@ -1157,7 +1151,6 @@ class TaskService extends EventEmitter implements ITaskService { } return TaskConfig.JsonSchemaVersion.from(config); } - */ private getConfiguration(): { config: TaskConfig.ExternalTaskRunnerConfiguration; hasParseErrors: boolean } { let result = this.configurationService.getConfiguration('tasks');