@theia/task 1.18.0-next.d3501165 → 1.19.0

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 (40) hide show
  1. package/LICENSE +642 -0
  2. package/lib/browser/provided-task-configurations.js +4 -4
  3. package/lib/browser/provided-task-configurations.js.map +1 -1
  4. package/lib/browser/quick-open-task.d.ts +1 -2
  5. package/lib/browser/quick-open-task.d.ts.map +1 -1
  6. package/lib/browser/quick-open-task.js +1 -2
  7. package/lib/browser/quick-open-task.js.map +1 -1
  8. package/lib/browser/task-configuration-manager.js +1 -1
  9. package/lib/browser/task-configuration-manager.js.map +1 -1
  10. package/lib/browser/task-configurations.d.ts.map +1 -1
  11. package/lib/browser/task-configurations.js +3 -2
  12. package/lib/browser/task-configurations.js.map +1 -1
  13. package/lib/browser/task-definition-registry.js +4 -4
  14. package/lib/browser/task-definition-registry.js.map +1 -1
  15. package/lib/browser/task-frontend-contribution.d.ts +1 -2
  16. package/lib/browser/task-frontend-contribution.d.ts.map +1 -1
  17. package/lib/browser/task-frontend-contribution.js +30 -29
  18. package/lib/browser/task-frontend-contribution.js.map +1 -1
  19. package/lib/browser/task-schema-updater.d.ts.map +1 -1
  20. package/lib/browser/task-schema-updater.js +2 -1
  21. package/lib/browser/task-schema-updater.js.map +1 -1
  22. package/lib/browser/task-service.d.ts.map +1 -1
  23. package/lib/browser/task-service.js +8 -0
  24. package/lib/browser/task-service.js.map +1 -1
  25. package/lib/common/task-protocol.d.ts +5 -1
  26. package/lib/common/task-protocol.d.ts.map +1 -1
  27. package/lib/node/process/process-task-runner.d.ts.map +1 -1
  28. package/lib/node/process/process-task-runner.js +1 -2
  29. package/lib/node/process/process-task-runner.js.map +1 -1
  30. package/package.json +19 -17
  31. package/src/browser/provided-task-configurations.ts +4 -4
  32. package/src/browser/quick-open-task.ts +1 -2
  33. package/src/browser/task-configuration-manager.ts +1 -1
  34. package/src/browser/task-configurations.ts +3 -4
  35. package/src/browser/task-definition-registry.ts +4 -4
  36. package/src/browser/task-frontend-contribution.ts +31 -31
  37. package/src/browser/task-schema-updater.ts +2 -1
  38. package/src/browser/task-service.ts +9 -0
  39. package/src/common/task-protocol.ts +5 -1
  40. package/src/node/process/process-task-runner.ts +1 -2
@@ -15,9 +15,8 @@
15
15
  ********************************************************************************/
16
16
 
17
17
  import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify';
18
- import { ILogger, ContributionProvider } from '@theia/core/lib/common';
18
+ import { ILogger, ContributionProvider, CommandContribution, Command, CommandRegistry, MenuContribution, MenuModelRegistry } from '@theia/core/lib/common';
19
19
  import { QuickOpenTask, TaskTerminateQuickOpen, TaskRunningQuickOpen, TaskRestartRunningQuickOpen } from './quick-open-task';
20
- import { CommandContribution, Command, CommandRegistry, MenuContribution, MenuModelRegistry } from '@theia/core/lib/common';
21
20
  import {
22
21
  FrontendApplication, FrontendApplicationContribution, QuickAccessContribution,
23
22
  KeybindingRegistry, KeybindingContribution, StorageService, StatusBar, StatusBarAlignment
@@ -32,83 +31,84 @@ import { EditorManager } from '@theia/editor/lib/browser';
32
31
  import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
33
32
 
34
33
  export namespace TaskCommands {
34
+ const TASK_CATEGORY_KEY = 'vscode/settingsLayout/task';
35
35
  const TASK_CATEGORY = 'Task';
36
- export const TASK_RUN: Command = {
36
+ export const TASK_RUN = Command.toLocalizedCommand({
37
37
  id: 'task:run',
38
38
  category: TASK_CATEGORY,
39
39
  label: 'Run Task...'
40
- };
40
+ }, 'vscode/task.contribution/RunTaskAction.label', TASK_CATEGORY_KEY);
41
41
 
42
- export const TASK_RUN_BUILD: Command = {
42
+ export const TASK_RUN_BUILD = Command.toLocalizedCommand({
43
43
  id: 'task:run:build',
44
44
  category: TASK_CATEGORY,
45
45
  label: 'Run Build Task...'
46
- };
46
+ }, 'vscode/task.contribution/BuildAction.label', TASK_CATEGORY_KEY);
47
47
 
48
- export const TASK_RUN_TEST: Command = {
48
+ export const TASK_RUN_TEST = Command.toLocalizedCommand({
49
49
  id: 'task:run:test',
50
50
  category: TASK_CATEGORY,
51
51
  label: 'Run Test Task...'
52
- };
52
+ }, 'vscode/task.contribution/TestAction.label', TASK_CATEGORY_KEY);
53
53
 
54
- export const WORKBENCH_RUN_TASK: Command = {
54
+ export const WORKBENCH_RUN_TASK = Command.toLocalizedCommand({
55
55
  id: 'workbench.action.tasks.runTask',
56
56
  category: TASK_CATEGORY
57
- };
57
+ }, '', TASK_CATEGORY_KEY);
58
58
 
59
- export const TASK_RUN_LAST: Command = {
59
+ export const TASK_RUN_LAST = Command.toLocalizedCommand({
60
60
  id: 'task:run:last',
61
61
  category: TASK_CATEGORY,
62
62
  label: 'Run Last Task'
63
- };
63
+ }, 'vscode/task.contribution/ReRunTaskAction.label', TASK_CATEGORY_KEY);
64
64
 
65
- export const TASK_ATTACH: Command = {
65
+ export const TASK_ATTACH = Command.toLocalizedCommand({
66
66
  id: 'task:attach',
67
67
  category: TASK_CATEGORY,
68
68
  label: 'Attach Task...'
69
- };
69
+ }, 'theia/task/attachTask', TASK_CATEGORY_KEY);
70
70
 
71
- export const TASK_RUN_TEXT: Command = {
71
+ export const TASK_RUN_TEXT = Command.toLocalizedCommand({
72
72
  id: 'task:run:text',
73
73
  category: TASK_CATEGORY,
74
74
  label: 'Run Selected Text'
75
- };
75
+ }, 'vscode/terminalMenu/miRunSelectedText', TASK_CATEGORY_KEY);
76
76
 
77
- export const TASK_CONFIGURE: Command = {
77
+ export const TASK_CONFIGURE = Command.toLocalizedCommand({
78
78
  id: 'task:configure',
79
79
  category: TASK_CATEGORY,
80
80
  label: 'Configure Tasks...'
81
- };
81
+ }, 'vscode/task.contribution/miConfigureTask', TASK_CATEGORY_KEY);
82
82
 
83
- export const TASK_OPEN_USER: Command = {
83
+ export const TASK_OPEN_USER = Command.toLocalizedCommand({
84
84
  id: 'task:open_user',
85
85
  category: TASK_CATEGORY,
86
86
  label: 'Open User Tasks'
87
- };
87
+ }, 'theia/task/openUserTasks', TASK_CATEGORY_KEY);
88
88
 
89
- export const TASK_CLEAR_HISTORY: Command = {
89
+ export const TASK_CLEAR_HISTORY = Command.toLocalizedCommand({
90
90
  id: 'task:clear-history',
91
91
  category: TASK_CATEGORY,
92
92
  label: 'Clear History'
93
- };
93
+ }, 'theia/task/clearHistory', TASK_CATEGORY_KEY);
94
94
 
95
- export const TASK_SHOW_RUNNING: Command = {
95
+ export const TASK_SHOW_RUNNING = Command.toLocalizedCommand({
96
96
  id: 'task:show-running',
97
97
  category: TASK_CATEGORY,
98
98
  label: 'Show Running Tasks'
99
- };
99
+ }, 'vscode/task.contribution/runningTasks', TASK_CATEGORY_KEY);
100
100
 
101
- export const TASK_TERMINATE: Command = {
101
+ export const TASK_TERMINATE = Command.toLocalizedCommand({
102
102
  id: 'task:terminate',
103
103
  category: TASK_CATEGORY,
104
104
  label: 'Terminate Task'
105
- };
105
+ }, 'vscode/abstractTaskService/terminateTask', TASK_CATEGORY_KEY);
106
106
 
107
- export const TASK_RESTART_RUNNING: Command = {
107
+ export const TASK_RESTART_RUNNING = Command.toLocalizedCommand({
108
108
  id: 'task:restart-running',
109
109
  category: TASK_CATEGORY,
110
110
  label: 'Restart Running Task...'
111
- };
111
+ }, 'vscode/abstractTaskService/restartTask', TASK_CATEGORY_KEY);
112
112
  }
113
113
 
114
114
  const TASKS_STORAGE_KEY = 'tasks';
@@ -202,7 +202,7 @@ export class TaskFrontendContribution implements CommandContribution, MenuContri
202
202
  if (!!items.length) {
203
203
  this.statusBar.setElement(id, {
204
204
  text: `$(tools) ${items.length}`,
205
- tooltip: 'Show Running Tasks',
205
+ tooltip: TaskCommands.TASK_SHOW_RUNNING.label,
206
206
  alignment: StatusBarAlignment.LEFT,
207
207
  priority: 2,
208
208
  command: TaskCommands.TASK_SHOW_RUNNING.id,
@@ -362,7 +362,7 @@ export class TaskFrontendContribution implements CommandContribution, MenuContri
362
362
 
363
363
  menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS_INFO, {
364
364
  commandId: TaskCommands.TASK_SHOW_RUNNING.id,
365
- label: 'Show Running Tasks...',
365
+ label: TaskCommands.TASK_SHOW_RUNNING.label + '...',
366
366
  order: '0'
367
367
  });
368
368
 
@@ -374,7 +374,7 @@ export class TaskFrontendContribution implements CommandContribution, MenuContri
374
374
 
375
375
  menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS_INFO, {
376
376
  commandId: TaskCommands.TASK_TERMINATE.id,
377
- label: 'Terminate Task...',
377
+ label: TaskCommands.TASK_TERMINATE.label + '...',
378
378
  order: '2'
379
379
  });
380
380
 
@@ -168,8 +168,9 @@ export class TaskSchemaUpdater implements JsonSchemaContribution {
168
168
  description: 'The task type to customize'
169
169
  };
170
170
  customizedDetectedTask.properties!.type = taskType;
171
+ const required = def.properties.required || [];
171
172
  def.properties.all.forEach(taskProp => {
172
- if (!!def.properties.required.find(requiredProp => requiredProp === taskProp)) { // property is mandatory
173
+ if (required.find(requiredProp => requiredProp === taskProp)) { // property is mandatory
173
174
  customizedDetectedTask.required!.push(taskProp);
174
175
  }
175
176
  customizedDetectedTask.properties![taskProp] = { ...def.properties.schema.properties![taskProp] };
@@ -735,6 +735,15 @@ export class TaskService implements TaskConfigurationClient {
735
735
  console.debug('got lock');
736
736
 
737
737
  try {
738
+ // resolve problemMatchers
739
+ if (!option && task.problemMatcher) {
740
+ const customizationObject: TaskCustomization = { type: task.taskType, problemMatcher: task.problemMatcher };
741
+ const resolvedMatchers = await this.resolveProblemMatchers(task, customizationObject);
742
+ option = {
743
+ customization: { ...customizationObject, ...{ problemMatcher: resolvedMatchers } }
744
+ };
745
+ }
746
+
738
747
  const runningTasksInfo: TaskInfo[] = await this.getRunningTasks();
739
748
  // check if the task is active
740
749
  const matchedRunningTaskInfo = runningTasksInfo.find(taskInfo => {
@@ -274,7 +274,11 @@ export interface TaskDefinition {
274
274
  taskType: string;
275
275
  source: string;
276
276
  properties: {
277
- required: string[];
277
+ /**
278
+ * Should be treated as an empty array if omitted.
279
+ * https://json-schema.org/draft/2020-12/json-schema-validation.html#rfc.section.6.5.3
280
+ */
281
+ required?: string[];
278
282
  all: string[];
279
283
  schema: IJSONSchema;
280
284
  }
@@ -20,7 +20,7 @@
20
20
  *--------------------------------------------------------------------------------------------*/
21
21
 
22
22
  import { injectable, inject, named } from '@theia/core/shared/inversify';
23
- import { isWindows, isOSX, ILogger } from '@theia/core';
23
+ import { deepClone, isWindows, isOSX, ILogger } from '@theia/core';
24
24
  import { FileUri } from '@theia/core/lib/node';
25
25
  import {
26
26
  RawProcessFactory,
@@ -39,7 +39,6 @@ import { TaskConfiguration } from '../../common/task-protocol';
39
39
  import { ProcessTaskError, CommandOptions } from '../../common/process/task-protocol';
40
40
  import * as fs from 'fs';
41
41
  import { ShellProcess } from '@theia/terminal/lib/node/shell-process';
42
- import { deepClone } from '@theia/core';
43
42
 
44
43
  /**
45
44
  * Task runner that runs a task as a process or a command inside a shell.