Skip to content

Commit 18ca304

Browse files
committed
Fixes #29852: Task 2.0.0 schema polish
1 parent 02b9fb1 commit 18ca304

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

src/vs/workbench/parts/tasks/electron-browser/jsonSchemaCommon.ts

+1
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ const schema: IJSONSchema = {
175175
},
176176
taskRunnerConfiguration: {
177177
type: 'object',
178+
required: [],
178179
properties: {
179180
command: {
180181
type: 'string',

src/vs/workbench/parts/tasks/electron-browser/jsonSchema_v2.ts

+19-2
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,13 @@ const group: IJSONSchema = {
145145
const taskType: IJSONSchema = {
146146
type: 'string',
147147
enum: ['shell', 'process'],
148-
default: 'process',
149-
description: nls.localize('JsonSchema.tasks.type', 'Defines whether the task is run as a process or as a command inside a shell. Default is process.')
148+
default: 'shell',
149+
description: nls.localize('JsonSchema.tasks.type', 'Defines whether the task is run as a process or as a command inside a shell.')
150+
};
151+
152+
const label: IJSONSchema = {
153+
type: 'string',
154+
description: nls.localize('JsonSchema.tasks.label', "The task's user interface label")
150155
};
151156

152157
const version: IJSONSchema = {
@@ -224,13 +229,25 @@ taskDefinitions.push(customize);
224229

225230
let definitions = Objects.deepClone(commonSchema.definitions);
226231
let taskDescription: IJSONSchema = definitions.taskDescription;
232+
taskDescription.required = ['label', 'type'];
233+
taskDescription.properties.label = Objects.deepClone(label);
227234
taskDescription.properties.isShellCommand = Objects.deepClone(shellCommand);
228235
taskDescription.properties.dependsOn = dependsOn;
229236
taskDescription.properties.identifier = Objects.deepClone(identifier);
230237
taskDescription.properties.type = Objects.deepClone(taskType);
231238
taskDescription.properties.presentation = Objects.deepClone(presentation);
232239
taskDescription.properties.terminal = terminal;
233240
taskDescription.properties.group = Objects.deepClone(group);
241+
taskDescription.properties.taskName.deprecationMessage = nls.localize(
242+
'JsonSchema.tasks.taskName.deprecated',
243+
'The task\'s name property is deprecated. Use the label property instead.'
244+
);
245+
taskDescription.default = {
246+
label: 'My Task',
247+
type: 'shell',
248+
command: 'echo Hello',
249+
problemMatcher: []
250+
};
234251
definitions.showOutputType.deprecationMessage = nls.localize(
235252
'JsonSchema.tasks.showOputput.deprecated',
236253
'The property showOutput is deprecated. Use the reveal property inside the presentation property instead. See also the 1.14 release notes.'

src/vs/workbench/parts/tasks/node/taskConfiguration.ts

+3
Original file line numberDiff line numberDiff line change
@@ -1246,6 +1246,9 @@ namespace CustomTask {
12461246
return undefined;
12471247
}
12481248
let taskName = external.taskName;
1249+
if (Types.isString(external.label) && context.schemaVersion === Tasks.JsonSchemaVersion.V2_0_0) {
1250+
taskName = external.label;
1251+
}
12491252
if (!taskName) {
12501253
context.problemReporter.error(nls.localize('ConfigurationParser.noTaskName', 'Error: tasks must provide a taskName property. The task will be ignored.\n{0}\n', JSON.stringify(external, null, 4)));
12511254
return undefined;

0 commit comments

Comments
 (0)