diff --git a/src/vs/vscode.d.ts b/src/vs/vscode.d.ts index 5ce1237ebd6..efe3eb07a9b 100644 --- a/src/vs/vscode.d.ts +++ b/src/vs/vscode.d.ts @@ -4471,6 +4471,9 @@ declare module 'vscode' { * script: string; * } * ``` + * + * Note that type identifier starting with a '$' are reserved for internal + * usages and shouldn't be used by extensions. */ readonly type: string; diff --git a/src/vs/workbench/api/electron-browser/mainThreadTask.ts b/src/vs/workbench/api/electron-browser/mainThreadTask.ts index cd32296c9da..75f08197085 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadTask.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadTask.ts @@ -285,9 +285,6 @@ namespace TaskDTO { } } } - if (!result.execution) { - return undefined; - } return result; } diff --git a/src/vs/workbench/api/node/extHostTask.ts b/src/vs/workbench/api/node/extHostTask.ts index 024ad5f56b0..194121f17cc 100644 --- a/src/vs/workbench/api/node/extHostTask.ts +++ b/src/vs/workbench/api/node/extHostTask.ts @@ -610,7 +610,7 @@ namespace TaskDTO { scope = value.scope.uri.toJSON(); } } - if (!execution || !definition || !scope) { + if (!definition || !scope) { return undefined; } let group = (value.group as types.TaskGroup) ? (value.group as types.TaskGroup).id : undefined; @@ -655,7 +655,7 @@ namespace TaskDTO { scope = types.TaskScope.Workspace; } } - if (!execution || !definition || !scope) { + if (!definition || !scope) { return undefined; } let result = new types.Task(definition, scope, value.name, value.source.label, execution, value.problemMatchers); diff --git a/src/vs/workbench/parts/tasks/common/taskDefinitionRegistry.ts b/src/vs/workbench/parts/tasks/common/taskDefinitionRegistry.ts index cc197afc0ce..7a2bab4ba3a 100644 --- a/src/vs/workbench/parts/tasks/common/taskDefinitionRegistry.ts +++ b/src/vs/workbench/parts/tasks/common/taskDefinitionRegistry.ts @@ -22,7 +22,7 @@ const taskDefinitionSchema: IJSONSchema = { properties: { type: { type: 'string', - description: nls.localize('TaskDefinition.description', 'The actual task type') + description: nls.localize('TaskDefinition.description', 'The actual task type. Please note that types starting with a \'$\' are reserved for internal usage.') }, required: { type: 'array', diff --git a/src/vs/workbench/parts/tasks/common/tasks.ts b/src/vs/workbench/parts/tasks/common/tasks.ts index 8fd3e0fc004..bfdbdad02e7 100644 --- a/src/vs/workbench/parts/tasks/common/tasks.ts +++ b/src/vs/workbench/parts/tasks/common/tasks.ts @@ -7,14 +7,12 @@ import * as Types from 'vs/base/common/types'; import { IJSONSchemaMap } from 'vs/base/common/jsonSchema'; import * as Objects from 'vs/base/common/objects'; -import { generateUuid } from 'vs/base/common/uuid'; import { UriComponents } from 'vs/base/common/uri'; import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions'; import { ProblemMatcher } from 'vs/workbench/parts/tasks/common/problemMatcher'; import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace'; - export enum ShellQuoting { /** * Default is character escaping. @@ -445,20 +443,18 @@ export namespace CustomTask { return candidate && candidate.type === 'custom'; } export function getDefinition(task: CustomTask): TaskIdentifier { - if (task.command === void 0) { - return undefined; - } - if (task.command.runtime === RuntimeType.Shell) { - return { - _key: generateUuid(), - type: 'shell' - }; + let type: string; + if (task.command !== void 0) { + type = task.command.runtime === RuntimeType.Shell ? 'shell' : 'process'; } else { - return { - _key: generateUuid(), - type: 'process' - }; + type = '$composite'; } + let result: TaskIdentifier = { + type, + _key: task._id, + id: task._id + }; + return result; } } @@ -617,7 +613,7 @@ export namespace Task { export function getTaskDefinition(task: Task): TaskIdentifier { if (ContributedTask.is(task)) { return task.defines; - } else if (CustomTask.is(task) && task.command !== void 0) { + } else if (CustomTask.is(task)) { return CustomTask.getDefinition(task); } else { return undefined;