@theia/task 1.34.2 → 1.34.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/LICENSE +641 -641
  2. package/README.md +193 -193
  3. package/lib/browser/index.d.ts +6 -6
  4. package/lib/browser/index.js +33 -33
  5. package/lib/browser/process/process-task-contribution.d.ts +6 -6
  6. package/lib/browser/process/process-task-contribution.js +43 -43
  7. package/lib/browser/process/process-task-frontend-module.d.ts +2 -2
  8. package/lib/browser/process/process-task-frontend-module.js +27 -27
  9. package/lib/browser/process/process-task-resolver.d.ts +17 -17
  10. package/lib/browser/process/process-task-resolver.js +93 -93
  11. package/lib/browser/provided-task-configurations.d.ts +32 -32
  12. package/lib/browser/provided-task-configurations.js +171 -171
  13. package/lib/browser/provided-task-configurations.spec.d.ts +1 -1
  14. package/lib/browser/provided-task-configurations.spec.js +43 -43
  15. package/lib/browser/quick-open-task.d.ts +129 -129
  16. package/lib/browser/quick-open-task.js +636 -636
  17. package/lib/browser/task-configuration-manager.d.ts +64 -64
  18. package/lib/browser/task-configuration-manager.js +261 -261
  19. package/lib/browser/task-configuration-model.d.ts +32 -32
  20. package/lib/browser/task-configuration-model.js +79 -79
  21. package/lib/browser/task-configurations.d.ts +127 -127
  22. package/lib/browser/task-configurations.js +479 -479
  23. package/lib/browser/task-contribution.d.ts +173 -173
  24. package/lib/browser/task-contribution.js +199 -199
  25. package/lib/browser/task-definition-registry.d.ts +38 -38
  26. package/lib/browser/task-definition-registry.js +131 -131
  27. package/lib/browser/task-definition-registry.spec.d.ts +1 -1
  28. package/lib/browser/task-definition-registry.spec.js +170 -170
  29. package/lib/browser/task-frontend-contribution.d.ts +56 -56
  30. package/lib/browser/task-frontend-contribution.js +353 -353
  31. package/lib/browser/task-frontend-module.d.ts +5 -5
  32. package/lib/browser/task-frontend-module.js +79 -79
  33. package/lib/browser/task-name-resolver.d.ts +13 -13
  34. package/lib/browser/task-name-resolver.js +65 -65
  35. package/lib/browser/task-node.d.ts +9 -9
  36. package/lib/browser/task-node.js +17 -17
  37. package/lib/browser/task-preferences.d.ts +4 -4
  38. package/lib/browser/task-preferences.js +40 -40
  39. package/lib/browser/task-problem-matcher-registry.d.ts +40 -40
  40. package/lib/browser/task-problem-matcher-registry.js +310 -310
  41. package/lib/browser/task-problem-pattern-registry.d.ts +23 -23
  42. package/lib/browser/task-problem-pattern-registry.js +208 -208
  43. package/lib/browser/task-schema-updater.d.ts +58 -58
  44. package/lib/browser/task-schema-updater.js +672 -672
  45. package/lib/browser/task-service.d.ts +276 -276
  46. package/lib/browser/task-service.js +1119 -1119
  47. package/lib/browser/task-source-resolver.d.ts +9 -9
  48. package/lib/browser/task-source-resolver.js +51 -51
  49. package/lib/browser/task-templates.d.ts +13 -13
  50. package/lib/browser/task-templates.js +161 -161
  51. package/lib/browser/task-terminal-widget-manager.d.ts +44 -44
  52. package/lib/browser/task-terminal-widget-manager.js +224 -224
  53. package/lib/browser/tasks-monaco-contribution.d.ts +1 -1
  54. package/lib/browser/tasks-monaco-contribution.js +27 -27
  55. package/lib/common/index.d.ts +3 -3
  56. package/lib/common/index.js +30 -30
  57. package/lib/common/problem-matcher-protocol.d.ts +124 -124
  58. package/lib/common/problem-matcher-protocol.js +132 -132
  59. package/lib/common/process/task-protocol.d.ts +68 -68
  60. package/lib/common/process/task-protocol.js +33 -33
  61. package/lib/common/task-common-module.d.ts +7 -7
  62. package/lib/common/task-common-module.js +33 -33
  63. package/lib/common/task-protocol.d.ts +190 -190
  64. package/lib/common/task-protocol.js +125 -125
  65. package/lib/common/task-watcher.d.ts +17 -17
  66. package/lib/common/task-watcher.js +86 -86
  67. package/lib/node/custom/custom-task-runner-backend-module.d.ts +2 -2
  68. package/lib/node/custom/custom-task-runner-backend-module.js +36 -36
  69. package/lib/node/custom/custom-task-runner-contribution.d.ts +6 -6
  70. package/lib/node/custom/custom-task-runner-contribution.js +42 -42
  71. package/lib/node/custom/custom-task-runner.d.ts +15 -15
  72. package/lib/node/custom/custom-task-runner.js +69 -69
  73. package/lib/node/custom/custom-task.d.ts +20 -20
  74. package/lib/node/custom/custom-task.js +78 -78
  75. package/lib/node/index.d.ts +3 -3
  76. package/lib/node/index.js +30 -30
  77. package/lib/node/process/process-task-runner-backend-module.d.ts +2 -2
  78. package/lib/node/process/process-task-runner-backend-module.js +36 -36
  79. package/lib/node/process/process-task-runner-contribution.d.ts +6 -6
  80. package/lib/node/process/process-task-runner-contribution.js +43 -43
  81. package/lib/node/process/process-task-runner.d.ts +60 -60
  82. package/lib/node/process/process-task-runner.js +352 -352
  83. package/lib/node/process/process-task.d.ts +26 -26
  84. package/lib/node/process/process-task.js +139 -139
  85. package/lib/node/process/process-task.spec.d.ts +1 -1
  86. package/lib/node/process/process-task.spec.js +29 -29
  87. package/lib/node/task-abstract-line-matcher.d.ts +49 -49
  88. package/lib/node/task-abstract-line-matcher.js +278 -278
  89. package/lib/node/task-backend-application-contribution.d.ts +8 -8
  90. package/lib/node/task-backend-application-contribution.js +48 -48
  91. package/lib/node/task-backend-module.d.ts +3 -3
  92. package/lib/node/task-backend-module.js +50 -50
  93. package/lib/node/task-line-matchers.d.ts +27 -27
  94. package/lib/node/task-line-matchers.js +121 -121
  95. package/lib/node/task-manager.d.ts +55 -55
  96. package/lib/node/task-manager.js +135 -135
  97. package/lib/node/task-problem-collector.d.ts +10 -10
  98. package/lib/node/task-problem-collector.js +57 -57
  99. package/lib/node/task-problem-collector.spec.d.ts +1 -1
  100. package/lib/node/task-problem-collector.spec.js +310 -310
  101. package/lib/node/task-runner-protocol.d.ts +16 -16
  102. package/lib/node/task-runner-protocol.js +19 -19
  103. package/lib/node/task-runner.d.ts +50 -50
  104. package/lib/node/task-runner.js +97 -97
  105. package/lib/node/task-server.d.ts +39 -39
  106. package/lib/node/task-server.js +237 -237
  107. package/lib/node/task-server.slow-spec.d.ts +1 -1
  108. package/lib/node/task-server.slow-spec.js +395 -395
  109. package/lib/node/task.d.ts +50 -50
  110. package/lib/node/task.js +77 -77
  111. package/lib/node/test/task-test-container.d.ts +2 -2
  112. package/lib/node/test/task-test-container.js +58 -58
  113. package/package.json +13 -13
  114. package/src/browser/index.ts +22 -22
  115. package/src/browser/process/process-task-contribution.ts +31 -31
  116. package/src/browser/process/process-task-frontend-module.ts +27 -27
  117. package/src/browser/process/process-task-resolver.ts +89 -89
  118. package/src/browser/provided-task-configurations.spec.ts +46 -46
  119. package/src/browser/provided-task-configurations.ts +170 -170
  120. package/src/browser/quick-open-task.ts +701 -701
  121. package/src/browser/style/index.css +19 -19
  122. package/src/browser/task-configuration-manager.ts +256 -256
  123. package/src/browser/task-configuration-model.ts +101 -101
  124. package/src/browser/task-configurations.ts +507 -507
  125. package/src/browser/task-contribution.ts +254 -254
  126. package/src/browser/task-definition-registry.spec.ts +203 -203
  127. package/src/browser/task-definition-registry.ts +128 -128
  128. package/src/browser/task-frontend-contribution.ts +396 -396
  129. package/src/browser/task-frontend-module.ts +86 -86
  130. package/src/browser/task-name-resolver.ts +55 -55
  131. package/src/browser/task-node.ts +37 -37
  132. package/src/browser/task-preferences.ts +40 -40
  133. package/src/browser/task-problem-matcher-registry.ts +308 -308
  134. package/src/browser/task-problem-pattern-registry.ts +195 -195
  135. package/src/browser/task-schema-updater.ts +703 -703
  136. package/src/browser/task-service.ts +1163 -1163
  137. package/src/browser/task-source-resolver.ts +36 -36
  138. package/src/browser/task-templates.ts +168 -168
  139. package/src/browser/task-terminal-widget-manager.ts +221 -221
  140. package/src/browser/tasks-monaco-contribution.ts +27 -27
  141. package/src/common/index.ts +19 -19
  142. package/src/common/problem-matcher-protocol.ts +235 -235
  143. package/src/common/process/task-protocol.ts +97 -97
  144. package/src/common/task-common-module.ts +34 -34
  145. package/src/common/task-protocol.ts +310 -310
  146. package/src/common/task-watcher.ts +78 -78
  147. package/src/node/custom/custom-task-runner-backend-module.ts +37 -37
  148. package/src/node/custom/custom-task-runner-contribution.ts +30 -30
  149. package/src/node/custom/custom-task-runner.ts +60 -60
  150. package/src/node/custom/custom-task.ts +73 -73
  151. package/src/node/index.ts +19 -19
  152. package/src/node/process/process-task-runner-backend-module.ts +37 -37
  153. package/src/node/process/process-task-runner-contribution.ts +31 -31
  154. package/src/node/process/process-task-runner.ts +371 -371
  155. package/src/node/process/process-task.spec.ts +30 -30
  156. package/src/node/process/process-task.ts +147 -147
  157. package/src/node/task-abstract-line-matcher.ts +317 -317
  158. package/src/node/task-backend-application-contribution.ts +36 -36
  159. package/src/node/task-backend-module.ts +57 -57
  160. package/src/node/task-line-matchers.ts +127 -127
  161. package/src/node/task-manager.ts +129 -129
  162. package/src/node/task-problem-collector.spec.ts +338 -338
  163. package/src/node/task-problem-collector.ts +62 -62
  164. package/src/node/task-runner-protocol.ts +33 -33
  165. package/src/node/task-runner.ts +96 -96
  166. package/src/node/task-server.slow-spec.ts +444 -444
  167. package/src/node/task-server.ts +263 -263
  168. package/src/node/task.ts +103 -103
  169. package/src/node/test/task-test-container.ts +63 -63
@@ -1,673 +1,673 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2019 Red Hat, Inc. and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- // This file is inspired by VSCode and partially copied from https://github.com/Microsoft/vscode/blob/1.33.1/src/vs/workbench/contrib/tasks/common/problemMatcher.ts
18
- // 'problemMatcher.ts' copyright:
19
- /*---------------------------------------------------------------------------------------------
20
- * Copyright (c) Microsoft Corporation. All rights reserved.
21
- * Licensed under the MIT License. See License.txt in the project root for license information.
22
- *--------------------------------------------------------------------------------------------*/
23
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
24
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
25
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
26
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
27
- return c > 3 && r && Object.defineProperty(target, key, r), r;
28
- };
29
- var __metadata = (this && this.__metadata) || function (k, v) {
30
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
31
- };
32
- Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.TaskSchemaUpdater = exports.taskSchemaId = void 0;
34
- const Ajv = require("@theia/core/shared/ajv");
35
- const debounce = require("p-debounce");
36
- const inversify_1 = require("@theia/core/shared/inversify");
37
- const common_1 = require("@theia/core/lib/common");
38
- const variable_input_schema_1 = require("@theia/variable-resolver/lib/browser/variable-input-schema");
39
- const uri_1 = require("@theia/core/lib/common/uri");
40
- const task_problem_matcher_registry_1 = require("./task-problem-matcher-registry");
41
- const task_definition_registry_1 = require("./task-definition-registry");
42
- const common_2 = require("../common");
43
- const browser_1 = require("@theia/userstorage/lib/browser");
44
- const browser_2 = require("@theia/workspace/lib/browser");
45
- exports.taskSchemaId = 'vscode://schemas/tasks';
46
- let TaskSchemaUpdater = class TaskSchemaUpdater {
47
- constructor() {
48
- this.onDidChangeTaskSchemaEmitter = new common_1.Emitter();
49
- this.onDidChangeTaskSchema = this.onDidChangeTaskSchemaEmitter.event;
50
- this.uri = new uri_1.default(exports.taskSchemaId);
51
- this.update = debounce(() => this.doUpdate(), 0);
52
- }
53
- init() {
54
- const resource = this.inmemoryResources.add(this.uri, '');
55
- if (resource.onDidChangeContents) {
56
- resource.onDidChangeContents(() => {
57
- this.onDidChangeTaskSchemaEmitter.fire(undefined);
58
- });
59
- }
60
- this.updateProblemMatcherNames();
61
- this.updateSupportedTaskTypes();
62
- // update problem matcher names in the task schema every time a problem matcher is added or disposed
63
- this.problemMatcherRegistry.onDidChangeProblemMatcher(() => this.updateProblemMatcherNames());
64
- // update supported task types in the task schema every time a task definition is registered or removed
65
- this.taskDefinitionRegistry.onDidRegisterTaskDefinition(() => this.updateSupportedTaskTypes());
66
- this.taskDefinitionRegistry.onDidUnregisterTaskDefinition(() => this.updateSupportedTaskTypes());
67
- }
68
- registerSchemas(context) {
69
- context.registerSchema({
70
- fileMatch: ['tasks.json', browser_1.UserStorageUri.resolve('tasks.json').toString()],
71
- url: this.uri.toString()
72
- });
73
- this.workspaceService.updateSchema('tasks', { $ref: this.uri.toString() });
74
- }
75
- doUpdate() {
76
- taskConfigurationSchema.anyOf = [processTaskConfigurationSchema, ...customizedDetectedTasks, ...customSchemas];
77
- const schema = this.getTaskSchema();
78
- this.doValidate = new Ajv().compile(schema);
79
- const schemaContent = JSON.stringify(schema);
80
- this.inmemoryResources.update(this.uri, schemaContent);
81
- }
82
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
83
- validate(data) {
84
- return !!this.doValidate && !!this.doValidate(data);
85
- }
86
- /**
87
- * Adds given task schema to `taskConfigurationSchema` as `oneOf` subschema.
88
- * Replaces existed subschema by given schema if the corresponding `$id` properties are equal.
89
- *
90
- * Note: please provide `$id` property for subschema to have ability remove/replace it.
91
- * @param schema subschema for adding to `taskConfigurationSchema`
92
- */
93
- addSubschema(schema) {
94
- const schemaId = schema.$id;
95
- if (schemaId) {
96
- this.doRemoveSubschema(schemaId);
97
- }
98
- customSchemas.push(schema);
99
- this.update();
100
- }
101
- /**
102
- * Removes task subschema from `taskConfigurationSchema`.
103
- *
104
- * @param arg `$id` property of subschema
105
- */
106
- removeSubschema(arg) {
107
- const isRemoved = this.doRemoveSubschema(arg);
108
- if (isRemoved) {
109
- this.update();
110
- }
111
- }
112
- /**
113
- * Removes task subschema from `customSchemas`, use `update()` to apply the changes for `taskConfigurationSchema`.
114
- *
115
- * @param arg `$id` property of subschema
116
- * @returns `true` if subschema was removed, `false` otherwise
117
- */
118
- doRemoveSubschema(arg) {
119
- const index = customSchemas.findIndex(existed => !!existed.$id && existed.$id === arg);
120
- if (index > -1) {
121
- customSchemas.splice(index, 1);
122
- return true;
123
- }
124
- return false;
125
- }
126
- /** Returns an array of task types that are registered, including the default types */
127
- async getRegisteredTaskTypes() {
128
- const serverSupportedTypes = await this.taskServer.getRegisteredTaskTypes();
129
- const browserSupportedTypes = this.taskDefinitionRegistry.getAll().map(def => def.taskType);
130
- const allTypes = new Set([...serverSupportedTypes, ...browserSupportedTypes]);
131
- return Array.from(allTypes.values()).sort();
132
- }
133
- updateSchemasForRegisteredTasks() {
134
- customizedDetectedTasks.length = 0;
135
- const definitions = this.taskDefinitionRegistry.getAll();
136
- definitions.forEach(def => {
137
- const customizedDetectedTask = {
138
- type: 'object',
139
- required: ['type'],
140
- properties: {}
141
- };
142
- const taskType = Object.assign(Object.assign({}, defaultTaskType), { enum: [def.taskType], default: def.taskType, description: 'The task type to customize' });
143
- customizedDetectedTask.properties.type = taskType;
144
- const required = def.properties.required || [];
145
- def.properties.all.forEach(taskProp => {
146
- if (required.find(requiredProp => requiredProp === taskProp)) { // property is mandatory
147
- customizedDetectedTask.required.push(taskProp);
148
- }
149
- customizedDetectedTask.properties[taskProp] = Object.assign({}, def.properties.schema.properties[taskProp]);
150
- });
151
- customizedDetectedTask.properties.label = taskLabel;
152
- customizedDetectedTask.properties.problemMatcher = problemMatcher;
153
- customizedDetectedTask.properties.presentation = presentation;
154
- customizedDetectedTask.properties.options = commandOptionsSchema;
155
- customizedDetectedTask.properties.group = group;
156
- customizedDetectedTask.properties.detail = detail;
157
- customizedDetectedTask.additionalProperties = true;
158
- customizedDetectedTasks.push(customizedDetectedTask);
159
- });
160
- }
161
- /** Returns the task's JSON schema */
162
- getTaskSchema() {
163
- return {
164
- type: 'object',
165
- default: { version: '2.0.0', tasks: [] },
166
- properties: {
167
- version: {
168
- type: 'string',
169
- default: '2.0.0'
170
- },
171
- tasks: {
172
- type: 'array',
173
- items: Object.assign({}, (0, common_1.deepClone)(taskConfigurationSchema))
174
- },
175
- inputs: variable_input_schema_1.inputsSchema.definitions.inputs
176
- },
177
- additionalProperties: false,
178
- allowComments: true,
179
- allowTrailingCommas: true,
180
- };
181
- }
182
- /** Gets the most up-to-date names of problem matchers from the registry and update the task schema */
183
- updateProblemMatcherNames() {
184
- const matcherNames = this.problemMatcherRegistry.getAll().map(m => m.name.startsWith('$') ? m.name : `$${m.name}`);
185
- problemMatcherNames.length = 0;
186
- problemMatcherNames.push(...matcherNames);
187
- this.update();
188
- }
189
- async updateSupportedTaskTypes() {
190
- this.updateSchemasForRegisteredTasks();
191
- this.update();
192
- }
193
- };
194
- __decorate([
195
- (0, inversify_1.inject)(common_1.InMemoryResources),
196
- __metadata("design:type", common_1.InMemoryResources)
197
- ], TaskSchemaUpdater.prototype, "inmemoryResources", void 0);
198
- __decorate([
199
- (0, inversify_1.inject)(task_problem_matcher_registry_1.ProblemMatcherRegistry),
200
- __metadata("design:type", task_problem_matcher_registry_1.ProblemMatcherRegistry)
201
- ], TaskSchemaUpdater.prototype, "problemMatcherRegistry", void 0);
202
- __decorate([
203
- (0, inversify_1.inject)(task_definition_registry_1.TaskDefinitionRegistry),
204
- __metadata("design:type", task_definition_registry_1.TaskDefinitionRegistry)
205
- ], TaskSchemaUpdater.prototype, "taskDefinitionRegistry", void 0);
206
- __decorate([
207
- (0, inversify_1.inject)(common_2.TaskServer),
208
- __metadata("design:type", Object)
209
- ], TaskSchemaUpdater.prototype, "taskServer", void 0);
210
- __decorate([
211
- (0, inversify_1.inject)(browser_2.WorkspaceService),
212
- __metadata("design:type", browser_2.WorkspaceService)
213
- ], TaskSchemaUpdater.prototype, "workspaceService", void 0);
214
- __decorate([
215
- (0, inversify_1.postConstruct)(),
216
- __metadata("design:type", Function),
217
- __metadata("design:paramtypes", []),
218
- __metadata("design:returntype", void 0)
219
- ], TaskSchemaUpdater.prototype, "init", null);
220
- TaskSchemaUpdater = __decorate([
221
- (0, inversify_1.injectable)()
222
- ], TaskSchemaUpdater);
223
- exports.TaskSchemaUpdater = TaskSchemaUpdater;
224
- const commandSchema = {
225
- type: 'string',
226
- description: 'The actual command or script to execute'
227
- };
228
- const commandArgSchema = {
229
- type: 'array',
230
- description: 'A list of strings, each one being one argument to pass to the command',
231
- items: {
232
- type: 'string'
233
- }
234
- };
235
- const commandOptionsSchema = {
236
- type: 'object',
237
- description: 'The command options used when the command is executed',
238
- properties: {
239
- cwd: {
240
- type: 'string',
241
- description: 'The directory in which the command will be executed',
242
- default: '${workspaceFolder}'
243
- },
244
- env: {
245
- type: 'object',
246
- description: 'The environment of the executed program or shell. If omitted the parent process\' environment is used'
247
- },
248
- shell: {
249
- type: 'object',
250
- description: 'Configuration of the shell when task type is `shell`',
251
- properties: {
252
- executable: {
253
- type: 'string',
254
- description: 'The shell to use'
255
- },
256
- args: {
257
- type: 'array',
258
- description: `The arguments to be passed to the shell executable to run in command mode
259
- (e.g ['-c'] for bash or ['/S', '/C'] for cmd.exe)`,
260
- items: {
261
- type: 'string'
262
- }
263
- }
264
- }
265
- }
266
- }
267
- };
268
- const problemMatcherNames = [];
269
- const defaultTaskTypes = ['shell', 'process'];
270
- const supportedTaskTypes = [...defaultTaskTypes];
271
- const taskLabel = {
272
- type: 'string',
273
- description: 'A unique string that identifies the task that is also used as task\'s user interface label'
274
- };
275
- const defaultTaskType = {
276
- type: 'string',
277
- enum: supportedTaskTypes,
278
- default: defaultTaskTypes[0],
279
- description: 'Determines what type of process will be used to execute the task. Only shell types will have output shown on the user interface'
280
- };
281
- const commandAndArgs = {
282
- command: commandSchema,
283
- args: commandArgSchema,
284
- options: commandOptionsSchema
285
- };
286
- const group = {
287
- oneOf: [
288
- {
289
- type: 'string'
290
- },
291
- {
292
- type: 'object',
293
- properties: {
294
- kind: {
295
- type: 'string',
296
- default: 'none',
297
- description: 'The task\'s execution group.'
298
- },
299
- isDefault: {
300
- type: 'boolean',
301
- default: false,
302
- description: 'Defines if this task is the default task in the group.'
303
- }
304
- }
305
- }
306
- ],
307
- enum: [
308
- { kind: 'build', isDefault: true },
309
- { kind: 'test', isDefault: true },
310
- 'build',
311
- 'test',
312
- 'none'
313
- ],
314
- enumDescriptions: [
315
- 'Marks the task as the default build task.',
316
- 'Marks the task as the default test task.',
317
- 'Marks the task as a build task accessible through the \'Run Build Task\' command.',
318
- 'Marks the task as a test task accessible through the \'Run Test Task\' command.',
319
- 'Assigns the task to no group'
320
- ],
321
- // eslint-disable-next-line max-len
322
- description: 'Defines to which execution group this task belongs to. It supports "build" to add it to the build group and "test" to add it to the test group.'
323
- };
324
- const problemPattern = {
325
- default: {
326
- regexp: '^([^\\\\s].*)\\\\((\\\\d+,\\\\d+)\\\\):\\\\s*(.*)$',
327
- file: 1,
328
- location: 2,
329
- message: 3
330
- },
331
- type: 'object',
332
- properties: {
333
- regexp: {
334
- type: 'string',
335
- description: 'The regular expression to find an error, warning or info in the output.'
336
- },
337
- kind: {
338
- type: 'string',
339
- description: 'whether the pattern matches a location (file and line) or only a file.'
340
- },
341
- file: {
342
- type: 'integer',
343
- description: 'The match group index of the filename. If omitted 1 is used.'
344
- },
345
- location: {
346
- type: 'integer',
347
- // eslint-disable-next-line max-len
348
- description: 'The match group index of the problem\'s location. Valid location patterns are: (line), (line,column) and (startLine,startColumn,endLine,endColumn). If omitted (line,column) is assumed.'
349
- },
350
- line: {
351
- type: 'integer',
352
- description: 'The match group index of the problem\'s line. Defaults to 2'
353
- },
354
- column: {
355
- type: 'integer',
356
- description: 'The match group index of the problem\'s line character. Defaults to 3'
357
- },
358
- endLine: {
359
- type: 'integer',
360
- description: 'The match group index of the problem\'s end line. Defaults to undefined'
361
- },
362
- endColumn: {
363
- type: 'integer',
364
- description: 'The match group index of the problem\'s end line character. Defaults to undefined'
365
- },
366
- severity: {
367
- type: 'integer',
368
- description: 'The match group index of the problem\'s severity. Defaults to undefined'
369
- },
370
- code: {
371
- type: 'integer',
372
- description: 'The match group index of the problem\'s code. Defaults to undefined'
373
- },
374
- message: {
375
- type: 'integer',
376
- description: 'The match group index of the message. If omitted it defaults to 4 if location is specified. Otherwise it defaults to 5.'
377
- },
378
- loop: {
379
- type: 'boolean',
380
- // eslint-disable-next-line max-len
381
- description: 'In a multi line matcher loop indicated whether this pattern is executed in a loop as long as it matches. Can only specified on a last pattern in a multi line pattern.'
382
- }
383
- }
384
- };
385
- const multiLineProblemPattern = {
386
- type: 'array',
387
- items: problemPattern
388
- };
389
- const watchingPattern = {
390
- type: 'object',
391
- additionalProperties: false,
392
- properties: {
393
- regexp: {
394
- type: 'string',
395
- description: 'The regular expression to detect the begin or end of a background task.'
396
- },
397
- file: {
398
- type: 'integer',
399
- description: 'The match group index of the filename. Can be omitted.'
400
- },
401
- }
402
- };
403
- const patternType = {
404
- anyOf: [
405
- {
406
- type: 'string',
407
- description: 'The name of a contributed or predefined pattern'
408
- },
409
- problemPattern,
410
- multiLineProblemPattern
411
- ],
412
- description: 'A problem pattern or the name of a contributed or predefined problem pattern. Can be omitted if base is specified.'
413
- };
414
- const problemMatcherObject = {
415
- type: 'object',
416
- properties: {
417
- base: {
418
- type: 'string',
419
- enum: problemMatcherNames,
420
- description: 'The name of a base problem matcher to use.'
421
- },
422
- owner: {
423
- type: 'string',
424
- description: 'The owner of the problem inside Code. Can be omitted if base is specified. Defaults to \'external\' if omitted and base is not specified.'
425
- },
426
- source: {
427
- type: 'string',
428
- description: 'A human-readable string describing the source of this diagnostic, e.g. \'typescript\' or \'super lint\'.'
429
- },
430
- severity: {
431
- type: 'string',
432
- enum: ['error', 'warning', 'info'],
433
- description: 'The default severity for captures problems. Is used if the pattern doesn\'t define a match group for severity.'
434
- },
435
- applyTo: {
436
- type: 'string',
437
- enum: ['allDocuments', 'openDocuments', 'closedDocuments'],
438
- description: 'Controls if a problem reported on a text document is applied only to open, closed or all documents.'
439
- },
440
- pattern: patternType,
441
- fileLocation: {
442
- oneOf: [
443
- {
444
- type: 'string',
445
- enum: ['absolute', 'relative', 'autoDetect']
446
- },
447
- {
448
- type: 'array',
449
- items: {
450
- type: 'string'
451
- }
452
- }
453
- ],
454
- description: 'Defines how file names reported in a problem pattern should be interpreted.'
455
- },
456
- background: {
457
- type: 'object',
458
- additionalProperties: false,
459
- description: 'Patterns to track the begin and end of a matcher active on a background task.',
460
- properties: {
461
- activeOnStart: {
462
- type: 'boolean',
463
- description: 'If set to true the background monitor is in active mode when the task starts. This is equals of issuing a line that matches the beginsPattern'
464
- },
465
- beginsPattern: {
466
- oneOf: [
467
- {
468
- type: 'string'
469
- },
470
- watchingPattern
471
- ],
472
- description: 'If matched in the output the start of a background task is signaled.'
473
- },
474
- endsPattern: {
475
- oneOf: [
476
- {
477
- type: 'string'
478
- },
479
- watchingPattern
480
- ],
481
- description: 'If matched in the output the end of a background task is signaled.'
482
- }
483
- }
484
- },
485
- watching: {
486
- type: 'object',
487
- additionalProperties: false,
488
- deprecationMessage: 'The watching property is deprecated. Use background instead.',
489
- description: 'Patterns to track the begin and end of a watching matcher.',
490
- properties: {
491
- activeOnStart: {
492
- type: 'boolean',
493
- description: 'If set to true the watcher is in active mode when the task starts. This is equals of issuing a line that matches the beginPattern'
494
- },
495
- beginsPattern: {
496
- oneOf: [
497
- {
498
- type: 'string'
499
- },
500
- watchingPattern
501
- ],
502
- description: 'If matched in the output the start of a watching task is signaled.'
503
- },
504
- endsPattern: {
505
- oneOf: [
506
- {
507
- type: 'string'
508
- },
509
- watchingPattern
510
- ],
511
- description: 'If matched in the output the end of a watching task is signaled.'
512
- }
513
- }
514
- }
515
- }
516
- };
517
- const problemMatcher = {
518
- anyOf: [
519
- {
520
- type: 'string',
521
- description: 'Name of the problem matcher to parse the output of the task',
522
- enum: problemMatcherNames
523
- },
524
- {
525
- type: 'array',
526
- description: 'Name(s) of the problem matcher(s) to parse the output of the task',
527
- items: {
528
- type: 'string',
529
- enum: problemMatcherNames
530
- }
531
- },
532
- problemMatcherObject,
533
- {
534
- type: 'array',
535
- description: 'User defined problem matcher(s) to parse the output of the task',
536
- items: problemMatcherObject
537
- }
538
- ]
539
- };
540
- const presentation = {
541
- type: 'object',
542
- default: {
543
- echo: true,
544
- reveal: 'always',
545
- focus: false,
546
- panel: 'shared',
547
- showReuseMessage: true,
548
- clear: false
549
- },
550
- description: 'Configures the panel that is used to present the task\'s output and reads its input.',
551
- additionalProperties: true,
552
- properties: {
553
- echo: {
554
- type: 'boolean',
555
- default: true,
556
- description: 'Controls whether the executed command is echoed to the panel. Default is true.'
557
- },
558
- focus: {
559
- type: 'boolean',
560
- default: false,
561
- description: 'Controls whether the panel takes focus. Default is false. If set to true the panel is revealed as well.'
562
- },
563
- reveal: {
564
- type: 'string',
565
- enum: ['always', 'silent', 'never'],
566
- enumDescriptions: [
567
- 'Always reveals the terminal when this task is executed.',
568
- 'Only reveals the terminal if the task exits with an error or the problem matcher finds an error.',
569
- 'Never reveals the terminal when this task is executed.'
570
- ],
571
- default: 'always',
572
- description: 'Controls whether the terminal running the task is revealed or not. May be overridden by option \"revealProblems\". Default is \"always\".'
573
- },
574
- panel: {
575
- type: 'string',
576
- enum: ['shared', 'dedicated', 'new'],
577
- enumDescriptions: [
578
- 'The terminal is shared and the output of other task runs are added to the same terminal.',
579
- // eslint-disable-next-line max-len
580
- 'The terminal is dedicated to a specific task. If that task is executed again, the terminal is reused. However, the output of a different task is presented in a different terminal.',
581
- 'Every execution of that task is using a new clean terminal.'
582
- ],
583
- default: 'shared',
584
- description: 'Controls if the panel is shared between tasks, dedicated to this task or a new one is created on every run.'
585
- },
586
- showReuseMessage: {
587
- type: 'boolean',
588
- default: true,
589
- description: 'Controls whether to show the "Terminal will be reused by tasks" message.'
590
- },
591
- clear: {
592
- type: 'boolean',
593
- default: false,
594
- description: 'Controls whether the terminal is cleared before this task is run.'
595
- }
596
- }
597
- };
598
- const detail = {
599
- type: 'string',
600
- description: 'An optional description of a task that shows in the Run Task quick pick as a detail.'
601
- };
602
- const taskIdentifier = {
603
- type: 'object',
604
- additionalProperties: true,
605
- properties: {
606
- type: {
607
- type: 'string',
608
- description: 'The task identifier.'
609
- }
610
- }
611
- };
612
- const processTaskConfigurationSchema = {
613
- type: 'object',
614
- required: ['type', 'label', 'command'],
615
- properties: Object.assign(Object.assign({ label: taskLabel, type: defaultTaskType }, commandAndArgs), { isBackground: {
616
- type: 'boolean',
617
- default: false,
618
- description: 'Whether the executed task is kept alive and is running in the background.'
619
- }, dependsOn: {
620
- anyOf: [
621
- {
622
- type: 'string',
623
- description: 'Another task this task depends on.'
624
- },
625
- taskIdentifier,
626
- {
627
- type: 'array',
628
- description: 'The other tasks this task depends on.',
629
- items: {
630
- anyOf: [
631
- {
632
- type: 'string'
633
- },
634
- taskIdentifier
635
- ]
636
- }
637
- }
638
- ],
639
- description: 'Either a string representing another task or an array of other tasks that this task depends on.'
640
- }, dependsOrder: {
641
- type: 'string',
642
- enum: ['parallel', 'sequence'],
643
- enumDescriptions: [
644
- 'Run all dependsOn tasks in parallel.',
645
- 'Run all dependsOn tasks in sequence.'
646
- ],
647
- default: 'parallel',
648
- description: 'Determines the order of the dependsOn tasks for this task. Note that this property is not recursive.'
649
- }, windows: {
650
- type: 'object',
651
- description: 'Windows specific command configuration that overrides the command, args, and options',
652
- properties: commandAndArgs
653
- }, osx: {
654
- type: 'object',
655
- description: 'MacOS specific command configuration that overrides the command, args, and options',
656
- properties: commandAndArgs
657
- }, linux: {
658
- type: 'object',
659
- description: 'Linux specific command configuration that overrides the default command, args, and options',
660
- properties: commandAndArgs
661
- }, group,
662
- problemMatcher,
663
- presentation,
664
- detail }),
665
- additionalProperties: true
666
- };
667
- const customizedDetectedTasks = [];
668
- const customSchemas = [];
669
- const taskConfigurationSchema = {
670
- $id: exports.taskSchemaId,
671
- anyOf: [processTaskConfigurationSchema, ...customizedDetectedTasks, ...customSchemas]
672
- };
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2019 Red Hat, Inc. and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ // This file is inspired by VSCode and partially copied from https://github.com/Microsoft/vscode/blob/1.33.1/src/vs/workbench/contrib/tasks/common/problemMatcher.ts
18
+ // 'problemMatcher.ts' copyright:
19
+ /*---------------------------------------------------------------------------------------------
20
+ * Copyright (c) Microsoft Corporation. All rights reserved.
21
+ * Licensed under the MIT License. See License.txt in the project root for license information.
22
+ *--------------------------------------------------------------------------------------------*/
23
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
24
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
25
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
26
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
27
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
28
+ };
29
+ var __metadata = (this && this.__metadata) || function (k, v) {
30
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
31
+ };
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ exports.TaskSchemaUpdater = exports.taskSchemaId = void 0;
34
+ const Ajv = require("@theia/core/shared/ajv");
35
+ const debounce = require("p-debounce");
36
+ const inversify_1 = require("@theia/core/shared/inversify");
37
+ const common_1 = require("@theia/core/lib/common");
38
+ const variable_input_schema_1 = require("@theia/variable-resolver/lib/browser/variable-input-schema");
39
+ const uri_1 = require("@theia/core/lib/common/uri");
40
+ const task_problem_matcher_registry_1 = require("./task-problem-matcher-registry");
41
+ const task_definition_registry_1 = require("./task-definition-registry");
42
+ const common_2 = require("../common");
43
+ const browser_1 = require("@theia/userstorage/lib/browser");
44
+ const browser_2 = require("@theia/workspace/lib/browser");
45
+ exports.taskSchemaId = 'vscode://schemas/tasks';
46
+ let TaskSchemaUpdater = class TaskSchemaUpdater {
47
+ constructor() {
48
+ this.onDidChangeTaskSchemaEmitter = new common_1.Emitter();
49
+ this.onDidChangeTaskSchema = this.onDidChangeTaskSchemaEmitter.event;
50
+ this.uri = new uri_1.default(exports.taskSchemaId);
51
+ this.update = debounce(() => this.doUpdate(), 0);
52
+ }
53
+ init() {
54
+ const resource = this.inmemoryResources.add(this.uri, '');
55
+ if (resource.onDidChangeContents) {
56
+ resource.onDidChangeContents(() => {
57
+ this.onDidChangeTaskSchemaEmitter.fire(undefined);
58
+ });
59
+ }
60
+ this.updateProblemMatcherNames();
61
+ this.updateSupportedTaskTypes();
62
+ // update problem matcher names in the task schema every time a problem matcher is added or disposed
63
+ this.problemMatcherRegistry.onDidChangeProblemMatcher(() => this.updateProblemMatcherNames());
64
+ // update supported task types in the task schema every time a task definition is registered or removed
65
+ this.taskDefinitionRegistry.onDidRegisterTaskDefinition(() => this.updateSupportedTaskTypes());
66
+ this.taskDefinitionRegistry.onDidUnregisterTaskDefinition(() => this.updateSupportedTaskTypes());
67
+ }
68
+ registerSchemas(context) {
69
+ context.registerSchema({
70
+ fileMatch: ['tasks.json', browser_1.UserStorageUri.resolve('tasks.json').toString()],
71
+ url: this.uri.toString()
72
+ });
73
+ this.workspaceService.updateSchema('tasks', { $ref: this.uri.toString() });
74
+ }
75
+ doUpdate() {
76
+ taskConfigurationSchema.anyOf = [processTaskConfigurationSchema, ...customizedDetectedTasks, ...customSchemas];
77
+ const schema = this.getTaskSchema();
78
+ this.doValidate = new Ajv().compile(schema);
79
+ const schemaContent = JSON.stringify(schema);
80
+ this.inmemoryResources.update(this.uri, schemaContent);
81
+ }
82
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
83
+ validate(data) {
84
+ return !!this.doValidate && !!this.doValidate(data);
85
+ }
86
+ /**
87
+ * Adds given task schema to `taskConfigurationSchema` as `oneOf` subschema.
88
+ * Replaces existed subschema by given schema if the corresponding `$id` properties are equal.
89
+ *
90
+ * Note: please provide `$id` property for subschema to have ability remove/replace it.
91
+ * @param schema subschema for adding to `taskConfigurationSchema`
92
+ */
93
+ addSubschema(schema) {
94
+ const schemaId = schema.$id;
95
+ if (schemaId) {
96
+ this.doRemoveSubschema(schemaId);
97
+ }
98
+ customSchemas.push(schema);
99
+ this.update();
100
+ }
101
+ /**
102
+ * Removes task subschema from `taskConfigurationSchema`.
103
+ *
104
+ * @param arg `$id` property of subschema
105
+ */
106
+ removeSubschema(arg) {
107
+ const isRemoved = this.doRemoveSubschema(arg);
108
+ if (isRemoved) {
109
+ this.update();
110
+ }
111
+ }
112
+ /**
113
+ * Removes task subschema from `customSchemas`, use `update()` to apply the changes for `taskConfigurationSchema`.
114
+ *
115
+ * @param arg `$id` property of subschema
116
+ * @returns `true` if subschema was removed, `false` otherwise
117
+ */
118
+ doRemoveSubschema(arg) {
119
+ const index = customSchemas.findIndex(existed => !!existed.$id && existed.$id === arg);
120
+ if (index > -1) {
121
+ customSchemas.splice(index, 1);
122
+ return true;
123
+ }
124
+ return false;
125
+ }
126
+ /** Returns an array of task types that are registered, including the default types */
127
+ async getRegisteredTaskTypes() {
128
+ const serverSupportedTypes = await this.taskServer.getRegisteredTaskTypes();
129
+ const browserSupportedTypes = this.taskDefinitionRegistry.getAll().map(def => def.taskType);
130
+ const allTypes = new Set([...serverSupportedTypes, ...browserSupportedTypes]);
131
+ return Array.from(allTypes.values()).sort();
132
+ }
133
+ updateSchemasForRegisteredTasks() {
134
+ customizedDetectedTasks.length = 0;
135
+ const definitions = this.taskDefinitionRegistry.getAll();
136
+ definitions.forEach(def => {
137
+ const customizedDetectedTask = {
138
+ type: 'object',
139
+ required: ['type'],
140
+ properties: {}
141
+ };
142
+ const taskType = Object.assign(Object.assign({}, defaultTaskType), { enum: [def.taskType], default: def.taskType, description: 'The task type to customize' });
143
+ customizedDetectedTask.properties.type = taskType;
144
+ const required = def.properties.required || [];
145
+ def.properties.all.forEach(taskProp => {
146
+ if (required.find(requiredProp => requiredProp === taskProp)) { // property is mandatory
147
+ customizedDetectedTask.required.push(taskProp);
148
+ }
149
+ customizedDetectedTask.properties[taskProp] = Object.assign({}, def.properties.schema.properties[taskProp]);
150
+ });
151
+ customizedDetectedTask.properties.label = taskLabel;
152
+ customizedDetectedTask.properties.problemMatcher = problemMatcher;
153
+ customizedDetectedTask.properties.presentation = presentation;
154
+ customizedDetectedTask.properties.options = commandOptionsSchema;
155
+ customizedDetectedTask.properties.group = group;
156
+ customizedDetectedTask.properties.detail = detail;
157
+ customizedDetectedTask.additionalProperties = true;
158
+ customizedDetectedTasks.push(customizedDetectedTask);
159
+ });
160
+ }
161
+ /** Returns the task's JSON schema */
162
+ getTaskSchema() {
163
+ return {
164
+ type: 'object',
165
+ default: { version: '2.0.0', tasks: [] },
166
+ properties: {
167
+ version: {
168
+ type: 'string',
169
+ default: '2.0.0'
170
+ },
171
+ tasks: {
172
+ type: 'array',
173
+ items: Object.assign({}, (0, common_1.deepClone)(taskConfigurationSchema))
174
+ },
175
+ inputs: variable_input_schema_1.inputsSchema.definitions.inputs
176
+ },
177
+ additionalProperties: false,
178
+ allowComments: true,
179
+ allowTrailingCommas: true,
180
+ };
181
+ }
182
+ /** Gets the most up-to-date names of problem matchers from the registry and update the task schema */
183
+ updateProblemMatcherNames() {
184
+ const matcherNames = this.problemMatcherRegistry.getAll().map(m => m.name.startsWith('$') ? m.name : `$${m.name}`);
185
+ problemMatcherNames.length = 0;
186
+ problemMatcherNames.push(...matcherNames);
187
+ this.update();
188
+ }
189
+ async updateSupportedTaskTypes() {
190
+ this.updateSchemasForRegisteredTasks();
191
+ this.update();
192
+ }
193
+ };
194
+ __decorate([
195
+ (0, inversify_1.inject)(common_1.InMemoryResources),
196
+ __metadata("design:type", common_1.InMemoryResources)
197
+ ], TaskSchemaUpdater.prototype, "inmemoryResources", void 0);
198
+ __decorate([
199
+ (0, inversify_1.inject)(task_problem_matcher_registry_1.ProblemMatcherRegistry),
200
+ __metadata("design:type", task_problem_matcher_registry_1.ProblemMatcherRegistry)
201
+ ], TaskSchemaUpdater.prototype, "problemMatcherRegistry", void 0);
202
+ __decorate([
203
+ (0, inversify_1.inject)(task_definition_registry_1.TaskDefinitionRegistry),
204
+ __metadata("design:type", task_definition_registry_1.TaskDefinitionRegistry)
205
+ ], TaskSchemaUpdater.prototype, "taskDefinitionRegistry", void 0);
206
+ __decorate([
207
+ (0, inversify_1.inject)(common_2.TaskServer),
208
+ __metadata("design:type", Object)
209
+ ], TaskSchemaUpdater.prototype, "taskServer", void 0);
210
+ __decorate([
211
+ (0, inversify_1.inject)(browser_2.WorkspaceService),
212
+ __metadata("design:type", browser_2.WorkspaceService)
213
+ ], TaskSchemaUpdater.prototype, "workspaceService", void 0);
214
+ __decorate([
215
+ (0, inversify_1.postConstruct)(),
216
+ __metadata("design:type", Function),
217
+ __metadata("design:paramtypes", []),
218
+ __metadata("design:returntype", void 0)
219
+ ], TaskSchemaUpdater.prototype, "init", null);
220
+ TaskSchemaUpdater = __decorate([
221
+ (0, inversify_1.injectable)()
222
+ ], TaskSchemaUpdater);
223
+ exports.TaskSchemaUpdater = TaskSchemaUpdater;
224
+ const commandSchema = {
225
+ type: 'string',
226
+ description: 'The actual command or script to execute'
227
+ };
228
+ const commandArgSchema = {
229
+ type: 'array',
230
+ description: 'A list of strings, each one being one argument to pass to the command',
231
+ items: {
232
+ type: 'string'
233
+ }
234
+ };
235
+ const commandOptionsSchema = {
236
+ type: 'object',
237
+ description: 'The command options used when the command is executed',
238
+ properties: {
239
+ cwd: {
240
+ type: 'string',
241
+ description: 'The directory in which the command will be executed',
242
+ default: '${workspaceFolder}'
243
+ },
244
+ env: {
245
+ type: 'object',
246
+ description: 'The environment of the executed program or shell. If omitted the parent process\' environment is used'
247
+ },
248
+ shell: {
249
+ type: 'object',
250
+ description: 'Configuration of the shell when task type is `shell`',
251
+ properties: {
252
+ executable: {
253
+ type: 'string',
254
+ description: 'The shell to use'
255
+ },
256
+ args: {
257
+ type: 'array',
258
+ description: `The arguments to be passed to the shell executable to run in command mode
259
+ (e.g ['-c'] for bash or ['/S', '/C'] for cmd.exe)`,
260
+ items: {
261
+ type: 'string'
262
+ }
263
+ }
264
+ }
265
+ }
266
+ }
267
+ };
268
+ const problemMatcherNames = [];
269
+ const defaultTaskTypes = ['shell', 'process'];
270
+ const supportedTaskTypes = [...defaultTaskTypes];
271
+ const taskLabel = {
272
+ type: 'string',
273
+ description: 'A unique string that identifies the task that is also used as task\'s user interface label'
274
+ };
275
+ const defaultTaskType = {
276
+ type: 'string',
277
+ enum: supportedTaskTypes,
278
+ default: defaultTaskTypes[0],
279
+ description: 'Determines what type of process will be used to execute the task. Only shell types will have output shown on the user interface'
280
+ };
281
+ const commandAndArgs = {
282
+ command: commandSchema,
283
+ args: commandArgSchema,
284
+ options: commandOptionsSchema
285
+ };
286
+ const group = {
287
+ oneOf: [
288
+ {
289
+ type: 'string'
290
+ },
291
+ {
292
+ type: 'object',
293
+ properties: {
294
+ kind: {
295
+ type: 'string',
296
+ default: 'none',
297
+ description: 'The task\'s execution group.'
298
+ },
299
+ isDefault: {
300
+ type: 'boolean',
301
+ default: false,
302
+ description: 'Defines if this task is the default task in the group.'
303
+ }
304
+ }
305
+ }
306
+ ],
307
+ enum: [
308
+ { kind: 'build', isDefault: true },
309
+ { kind: 'test', isDefault: true },
310
+ 'build',
311
+ 'test',
312
+ 'none'
313
+ ],
314
+ enumDescriptions: [
315
+ 'Marks the task as the default build task.',
316
+ 'Marks the task as the default test task.',
317
+ 'Marks the task as a build task accessible through the \'Run Build Task\' command.',
318
+ 'Marks the task as a test task accessible through the \'Run Test Task\' command.',
319
+ 'Assigns the task to no group'
320
+ ],
321
+ // eslint-disable-next-line max-len
322
+ description: 'Defines to which execution group this task belongs to. It supports "build" to add it to the build group and "test" to add it to the test group.'
323
+ };
324
+ const problemPattern = {
325
+ default: {
326
+ regexp: '^([^\\\\s].*)\\\\((\\\\d+,\\\\d+)\\\\):\\\\s*(.*)$',
327
+ file: 1,
328
+ location: 2,
329
+ message: 3
330
+ },
331
+ type: 'object',
332
+ properties: {
333
+ regexp: {
334
+ type: 'string',
335
+ description: 'The regular expression to find an error, warning or info in the output.'
336
+ },
337
+ kind: {
338
+ type: 'string',
339
+ description: 'whether the pattern matches a location (file and line) or only a file.'
340
+ },
341
+ file: {
342
+ type: 'integer',
343
+ description: 'The match group index of the filename. If omitted 1 is used.'
344
+ },
345
+ location: {
346
+ type: 'integer',
347
+ // eslint-disable-next-line max-len
348
+ description: 'The match group index of the problem\'s location. Valid location patterns are: (line), (line,column) and (startLine,startColumn,endLine,endColumn). If omitted (line,column) is assumed.'
349
+ },
350
+ line: {
351
+ type: 'integer',
352
+ description: 'The match group index of the problem\'s line. Defaults to 2'
353
+ },
354
+ column: {
355
+ type: 'integer',
356
+ description: 'The match group index of the problem\'s line character. Defaults to 3'
357
+ },
358
+ endLine: {
359
+ type: 'integer',
360
+ description: 'The match group index of the problem\'s end line. Defaults to undefined'
361
+ },
362
+ endColumn: {
363
+ type: 'integer',
364
+ description: 'The match group index of the problem\'s end line character. Defaults to undefined'
365
+ },
366
+ severity: {
367
+ type: 'integer',
368
+ description: 'The match group index of the problem\'s severity. Defaults to undefined'
369
+ },
370
+ code: {
371
+ type: 'integer',
372
+ description: 'The match group index of the problem\'s code. Defaults to undefined'
373
+ },
374
+ message: {
375
+ type: 'integer',
376
+ description: 'The match group index of the message. If omitted it defaults to 4 if location is specified. Otherwise it defaults to 5.'
377
+ },
378
+ loop: {
379
+ type: 'boolean',
380
+ // eslint-disable-next-line max-len
381
+ description: 'In a multi line matcher loop indicated whether this pattern is executed in a loop as long as it matches. Can only specified on a last pattern in a multi line pattern.'
382
+ }
383
+ }
384
+ };
385
+ const multiLineProblemPattern = {
386
+ type: 'array',
387
+ items: problemPattern
388
+ };
389
+ const watchingPattern = {
390
+ type: 'object',
391
+ additionalProperties: false,
392
+ properties: {
393
+ regexp: {
394
+ type: 'string',
395
+ description: 'The regular expression to detect the begin or end of a background task.'
396
+ },
397
+ file: {
398
+ type: 'integer',
399
+ description: 'The match group index of the filename. Can be omitted.'
400
+ },
401
+ }
402
+ };
403
+ const patternType = {
404
+ anyOf: [
405
+ {
406
+ type: 'string',
407
+ description: 'The name of a contributed or predefined pattern'
408
+ },
409
+ problemPattern,
410
+ multiLineProblemPattern
411
+ ],
412
+ description: 'A problem pattern or the name of a contributed or predefined problem pattern. Can be omitted if base is specified.'
413
+ };
414
+ const problemMatcherObject = {
415
+ type: 'object',
416
+ properties: {
417
+ base: {
418
+ type: 'string',
419
+ enum: problemMatcherNames,
420
+ description: 'The name of a base problem matcher to use.'
421
+ },
422
+ owner: {
423
+ type: 'string',
424
+ description: 'The owner of the problem inside Code. Can be omitted if base is specified. Defaults to \'external\' if omitted and base is not specified.'
425
+ },
426
+ source: {
427
+ type: 'string',
428
+ description: 'A human-readable string describing the source of this diagnostic, e.g. \'typescript\' or \'super lint\'.'
429
+ },
430
+ severity: {
431
+ type: 'string',
432
+ enum: ['error', 'warning', 'info'],
433
+ description: 'The default severity for captures problems. Is used if the pattern doesn\'t define a match group for severity.'
434
+ },
435
+ applyTo: {
436
+ type: 'string',
437
+ enum: ['allDocuments', 'openDocuments', 'closedDocuments'],
438
+ description: 'Controls if a problem reported on a text document is applied only to open, closed or all documents.'
439
+ },
440
+ pattern: patternType,
441
+ fileLocation: {
442
+ oneOf: [
443
+ {
444
+ type: 'string',
445
+ enum: ['absolute', 'relative', 'autoDetect']
446
+ },
447
+ {
448
+ type: 'array',
449
+ items: {
450
+ type: 'string'
451
+ }
452
+ }
453
+ ],
454
+ description: 'Defines how file names reported in a problem pattern should be interpreted.'
455
+ },
456
+ background: {
457
+ type: 'object',
458
+ additionalProperties: false,
459
+ description: 'Patterns to track the begin and end of a matcher active on a background task.',
460
+ properties: {
461
+ activeOnStart: {
462
+ type: 'boolean',
463
+ description: 'If set to true the background monitor is in active mode when the task starts. This is equals of issuing a line that matches the beginsPattern'
464
+ },
465
+ beginsPattern: {
466
+ oneOf: [
467
+ {
468
+ type: 'string'
469
+ },
470
+ watchingPattern
471
+ ],
472
+ description: 'If matched in the output the start of a background task is signaled.'
473
+ },
474
+ endsPattern: {
475
+ oneOf: [
476
+ {
477
+ type: 'string'
478
+ },
479
+ watchingPattern
480
+ ],
481
+ description: 'If matched in the output the end of a background task is signaled.'
482
+ }
483
+ }
484
+ },
485
+ watching: {
486
+ type: 'object',
487
+ additionalProperties: false,
488
+ deprecationMessage: 'The watching property is deprecated. Use background instead.',
489
+ description: 'Patterns to track the begin and end of a watching matcher.',
490
+ properties: {
491
+ activeOnStart: {
492
+ type: 'boolean',
493
+ description: 'If set to true the watcher is in active mode when the task starts. This is equals of issuing a line that matches the beginPattern'
494
+ },
495
+ beginsPattern: {
496
+ oneOf: [
497
+ {
498
+ type: 'string'
499
+ },
500
+ watchingPattern
501
+ ],
502
+ description: 'If matched in the output the start of a watching task is signaled.'
503
+ },
504
+ endsPattern: {
505
+ oneOf: [
506
+ {
507
+ type: 'string'
508
+ },
509
+ watchingPattern
510
+ ],
511
+ description: 'If matched in the output the end of a watching task is signaled.'
512
+ }
513
+ }
514
+ }
515
+ }
516
+ };
517
+ const problemMatcher = {
518
+ anyOf: [
519
+ {
520
+ type: 'string',
521
+ description: 'Name of the problem matcher to parse the output of the task',
522
+ enum: problemMatcherNames
523
+ },
524
+ {
525
+ type: 'array',
526
+ description: 'Name(s) of the problem matcher(s) to parse the output of the task',
527
+ items: {
528
+ type: 'string',
529
+ enum: problemMatcherNames
530
+ }
531
+ },
532
+ problemMatcherObject,
533
+ {
534
+ type: 'array',
535
+ description: 'User defined problem matcher(s) to parse the output of the task',
536
+ items: problemMatcherObject
537
+ }
538
+ ]
539
+ };
540
+ const presentation = {
541
+ type: 'object',
542
+ default: {
543
+ echo: true,
544
+ reveal: 'always',
545
+ focus: false,
546
+ panel: 'shared',
547
+ showReuseMessage: true,
548
+ clear: false
549
+ },
550
+ description: 'Configures the panel that is used to present the task\'s output and reads its input.',
551
+ additionalProperties: true,
552
+ properties: {
553
+ echo: {
554
+ type: 'boolean',
555
+ default: true,
556
+ description: 'Controls whether the executed command is echoed to the panel. Default is true.'
557
+ },
558
+ focus: {
559
+ type: 'boolean',
560
+ default: false,
561
+ description: 'Controls whether the panel takes focus. Default is false. If set to true the panel is revealed as well.'
562
+ },
563
+ reveal: {
564
+ type: 'string',
565
+ enum: ['always', 'silent', 'never'],
566
+ enumDescriptions: [
567
+ 'Always reveals the terminal when this task is executed.',
568
+ 'Only reveals the terminal if the task exits with an error or the problem matcher finds an error.',
569
+ 'Never reveals the terminal when this task is executed.'
570
+ ],
571
+ default: 'always',
572
+ description: 'Controls whether the terminal running the task is revealed or not. May be overridden by option \"revealProblems\". Default is \"always\".'
573
+ },
574
+ panel: {
575
+ type: 'string',
576
+ enum: ['shared', 'dedicated', 'new'],
577
+ enumDescriptions: [
578
+ 'The terminal is shared and the output of other task runs are added to the same terminal.',
579
+ // eslint-disable-next-line max-len
580
+ 'The terminal is dedicated to a specific task. If that task is executed again, the terminal is reused. However, the output of a different task is presented in a different terminal.',
581
+ 'Every execution of that task is using a new clean terminal.'
582
+ ],
583
+ default: 'shared',
584
+ description: 'Controls if the panel is shared between tasks, dedicated to this task or a new one is created on every run.'
585
+ },
586
+ showReuseMessage: {
587
+ type: 'boolean',
588
+ default: true,
589
+ description: 'Controls whether to show the "Terminal will be reused by tasks" message.'
590
+ },
591
+ clear: {
592
+ type: 'boolean',
593
+ default: false,
594
+ description: 'Controls whether the terminal is cleared before this task is run.'
595
+ }
596
+ }
597
+ };
598
+ const detail = {
599
+ type: 'string',
600
+ description: 'An optional description of a task that shows in the Run Task quick pick as a detail.'
601
+ };
602
+ const taskIdentifier = {
603
+ type: 'object',
604
+ additionalProperties: true,
605
+ properties: {
606
+ type: {
607
+ type: 'string',
608
+ description: 'The task identifier.'
609
+ }
610
+ }
611
+ };
612
+ const processTaskConfigurationSchema = {
613
+ type: 'object',
614
+ required: ['type', 'label', 'command'],
615
+ properties: Object.assign(Object.assign({ label: taskLabel, type: defaultTaskType }, commandAndArgs), { isBackground: {
616
+ type: 'boolean',
617
+ default: false,
618
+ description: 'Whether the executed task is kept alive and is running in the background.'
619
+ }, dependsOn: {
620
+ anyOf: [
621
+ {
622
+ type: 'string',
623
+ description: 'Another task this task depends on.'
624
+ },
625
+ taskIdentifier,
626
+ {
627
+ type: 'array',
628
+ description: 'The other tasks this task depends on.',
629
+ items: {
630
+ anyOf: [
631
+ {
632
+ type: 'string'
633
+ },
634
+ taskIdentifier
635
+ ]
636
+ }
637
+ }
638
+ ],
639
+ description: 'Either a string representing another task or an array of other tasks that this task depends on.'
640
+ }, dependsOrder: {
641
+ type: 'string',
642
+ enum: ['parallel', 'sequence'],
643
+ enumDescriptions: [
644
+ 'Run all dependsOn tasks in parallel.',
645
+ 'Run all dependsOn tasks in sequence.'
646
+ ],
647
+ default: 'parallel',
648
+ description: 'Determines the order of the dependsOn tasks for this task. Note that this property is not recursive.'
649
+ }, windows: {
650
+ type: 'object',
651
+ description: 'Windows specific command configuration that overrides the command, args, and options',
652
+ properties: commandAndArgs
653
+ }, osx: {
654
+ type: 'object',
655
+ description: 'MacOS specific command configuration that overrides the command, args, and options',
656
+ properties: commandAndArgs
657
+ }, linux: {
658
+ type: 'object',
659
+ description: 'Linux specific command configuration that overrides the default command, args, and options',
660
+ properties: commandAndArgs
661
+ }, group,
662
+ problemMatcher,
663
+ presentation,
664
+ detail }),
665
+ additionalProperties: true
666
+ };
667
+ const customizedDetectedTasks = [];
668
+ const customSchemas = [];
669
+ const taskConfigurationSchema = {
670
+ $id: exports.taskSchemaId,
671
+ anyOf: [processTaskConfigurationSchema, ...customizedDetectedTasks, ...customSchemas]
672
+ };
673
673
  //# sourceMappingURL=task-schema-updater.js.map