未验证 提交 872cbd7d 编写于 作者: A Alex Ross 提交者: GitHub

'custom' task type should be '$customized' to conform to API doc (#62710)

Fixes #48835
上级 cfd2ea16
......@@ -32,6 +32,8 @@ export enum ShellQuoting {
Weak = 3,
}
export const CUSTOMIZED_TASK_TYPE = '$customized';
export namespace ShellQuoting {
export function from(this: void, value: string): ShellQuoting {
if (!value) {
......@@ -436,7 +438,7 @@ export interface CommonTask {
export interface CustomTask extends CommonTask, ConfigurationProperties {
type: 'custom';
type: '$customized'; // CUSTOMIZED_TASK_TYPE
/**
* Indicated the source of the task (e.g tasks.json or extension)
......@@ -458,7 +460,7 @@ export interface CustomTask extends CommonTask, ConfigurationProperties {
export namespace CustomTask {
export function is(value: any): value is CustomTask {
let candidate: CustomTask = value;
return candidate && candidate.type === 'custom';
return candidate && candidate.type === CUSTOMIZED_TASK_TYPE;
}
export function getDefinition(task: CustomTask): KeyedTaskIdentifier {
let type: string;
......@@ -564,7 +566,7 @@ export namespace Task {
if (!workspaceFolder) {
return undefined;
}
let key: CustomKey = { type: 'custom', folder: workspaceFolder.uri.toString(), id: task.identifier };
let key: CustomKey = { type: CUSTOMIZED_TASK_TYPE, folder: workspaceFolder.uri.toString(), id: task.identifier };
return JSON.stringify(key);
}
if (ContributedTask.is(task)) {
......
......@@ -317,7 +317,7 @@ export interface ConfigurationProperties {
export interface CustomTask extends CommandProperties, ConfigurationProperties {
/**
* Custom tasks have the type 'custom'
* Custom tasks have the type CUSTOMIZED_TASK_TYPE
*/
type?: string;
......@@ -1321,9 +1321,9 @@ namespace CustomTask {
}
let type = external.type;
if (type === void 0 || type === null) {
type = 'custom';
type = Tasks.CUSTOMIZED_TASK_TYPE;
}
if (type !== 'custom' && type !== 'shell' && type !== 'process') {
if (type !== Tasks.CUSTOMIZED_TASK_TYPE && type !== 'shell' && type !== 'process') {
context.problemReporter.error(nls.localize('ConfigurationParser.notCustom', 'Error: tasks is not declared as a custom task. The configuration will be ignored.\n{0}\n', JSON.stringify(external, null, 4)));
return undefined;
}
......@@ -1337,7 +1337,7 @@ namespace CustomTask {
}
let result: Tasks.CustomTask = {
type: 'custom',
type: Tasks.CUSTOMIZED_TASK_TYPE,
_id: context.uuidMap.getUUID(taskName),
_source: Objects.assign({}, source, { config: { index, element: external, file: '.vscode\\tasks.json', workspaceFolder: context.workspaceFolder } }),
_label: taskName,
......@@ -1413,7 +1413,7 @@ namespace CustomTask {
_id: configuredProps._id,
_source: Objects.assign({}, configuredProps._source, { customizes: contributedTask.defines }),
_label: configuredProps.name || contributedTask._label,
type: 'custom',
type: Tasks.CUSTOMIZED_TASK_TYPE,
command: contributedTask.command,
name: configuredProps.name || contributedTask.name,
identifier: configuredProps.identifier || contributedTask.identifier,
......@@ -1460,7 +1460,7 @@ namespace TaskParser {
function isCustomTask(value: CustomTask | ConfiguringTask): value is CustomTask {
let type = value.type;
let customize = (value as any).customize;
return customize === void 0 && (type === void 0 || type === null || type === 'custom' || type === 'shell' || type === 'process');
return customize === void 0 && (type === void 0 || type === null || type === Tasks.CUSTOMIZED_TASK_TYPE || type === 'shell' || type === 'process');
}
export function from(this: void, externals: (CustomTask | ConfiguringTask)[], globals: Globals, context: ParseContext): TaskParseResult {
......@@ -1839,7 +1839,7 @@ class ConfigurationParser {
_id: context.uuidMap.getUUID(name),
_source: Objects.assign({}, source, { config: { index: -1, element: fileConfig, workspaceFolder: context.workspaceFolder } }),
_label: name,
type: 'custom',
type: Tasks.CUSTOMIZED_TASK_TYPE,
name: name,
identifier: name,
group: Tasks.TaskGroup.Build,
......
......@@ -185,7 +185,7 @@ class CustomTaskBuilder {
_id: name,
_source: { kind: Tasks.TaskSourceKind.Workspace, label: 'workspace', config: { workspaceFolder: workspaceFolder, element: undefined, index: -1, file: '.vscode/tasks.json' } },
_label: name,
type: 'custom',
type: Tasks.CUSTOMIZED_TASK_TYPE,
identifier: name,
name: name,
command: this.commandBuilder.result,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册