@theia/task 1.65.0-next.6 → 1.65.1

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 (55) hide show
  1. package/lib/browser/quick-open-task.d.ts +4 -3
  2. package/lib/browser/quick-open-task.d.ts.map +1 -1
  3. package/lib/browser/quick-open-task.js +36 -24
  4. package/lib/browser/quick-open-task.js.map +1 -1
  5. package/lib/browser/task-configuration-manager.d.ts +5 -7
  6. package/lib/browser/task-configuration-manager.d.ts.map +1 -1
  7. package/lib/browser/task-configuration-manager.js +18 -29
  8. package/lib/browser/task-configuration-manager.js.map +1 -1
  9. package/lib/browser/task-configuration-model.d.ts +5 -4
  10. package/lib/browser/task-configuration-model.d.ts.map +1 -1
  11. package/lib/browser/task-configuration-model.js +16 -13
  12. package/lib/browser/task-configuration-model.js.map +1 -1
  13. package/lib/browser/task-frontend-module.js +1 -1
  14. package/lib/browser/task-frontend-module.js.map +1 -1
  15. package/lib/browser/task-problem-matcher-registry.d.ts.map +1 -1
  16. package/lib/browser/task-problem-matcher-registry.js +8 -8
  17. package/lib/browser/task-problem-matcher-registry.js.map +1 -1
  18. package/lib/browser/task-schema-updater.d.ts +0 -1
  19. package/lib/browser/task-schema-updater.d.ts.map +1 -1
  20. package/lib/browser/task-schema-updater.js +87 -88
  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 +20 -21
  24. package/lib/browser/task-service.js.map +1 -1
  25. package/lib/browser/task-templates.d.ts.map +1 -1
  26. package/lib/browser/task-templates.js +5 -4
  27. package/lib/browser/task-templates.js.map +1 -1
  28. package/lib/browser/task-terminal-widget-manager.d.ts.map +1 -1
  29. package/lib/browser/task-terminal-widget-manager.js +3 -2
  30. package/lib/browser/task-terminal-widget-manager.js.map +1 -1
  31. package/lib/common/task-preferences.d.ts +6 -0
  32. package/lib/common/task-preferences.d.ts.map +1 -0
  33. package/lib/{browser → common}/task-preferences.js +9 -9
  34. package/lib/common/task-preferences.js.map +1 -0
  35. package/lib/node/task-backend-module.d.ts.map +1 -1
  36. package/lib/node/task-backend-module.js +2 -0
  37. package/lib/node/task-backend-module.js.map +1 -1
  38. package/lib/node/task-server.slow-spec.js +7 -3
  39. package/lib/node/task-server.slow-spec.js.map +1 -1
  40. package/package.json +13 -13
  41. package/src/browser/quick-open-task.ts +35 -24
  42. package/src/browser/task-configuration-manager.ts +15 -20
  43. package/src/browser/task-configuration-model.ts +18 -15
  44. package/src/browser/task-frontend-module.ts +1 -1
  45. package/src/browser/task-problem-matcher-registry.ts +9 -9
  46. package/src/browser/task-schema-updater.ts +91 -87
  47. package/src/browser/task-service.ts +21 -22
  48. package/src/browser/task-templates.ts +5 -4
  49. package/src/browser/task-terminal-widget-manager.ts +3 -2
  50. package/src/{browser → common}/task-preferences.ts +7 -6
  51. package/src/node/task-backend-module.ts +2 -0
  52. package/src/node/task-server.slow-spec.ts +8 -3
  53. package/lib/browser/task-preferences.d.ts +0 -5
  54. package/lib/browser/task-preferences.d.ts.map +0 -1
  55. package/lib/browser/task-preferences.js.map +0 -1
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { ApplicationShell, FrontendApplication, QuickPickValue, WidgetManager, WidgetOpenMode } from '@theia/core/lib/browser';
18
18
  import { open, OpenerService } from '@theia/core/lib/browser/opener-service';
19
- import { CommandService, ILogger } from '@theia/core/lib/common';
19
+ import { CommandService, ILogger, nls } from '@theia/core/lib/common';
20
20
  import { MessageService } from '@theia/core/lib/common/message-service';
21
21
  import { Deferred } from '@theia/core/lib/common/promise-util';
22
22
  import { QuickPickItemOrSeparator, QuickPickService } from '@theia/core/lib/common/quick-pick-service';
@@ -326,10 +326,10 @@ export class TaskService implements TaskConfigurationClient {
326
326
  }
327
327
  }
328
328
  }
329
- this.messageService.error(`Task '${taskIdentifier}' has exited with code ${event.code}.`);
329
+ this.messageService.error(nls.localize('theia/task/taskExitedWithCode', "Task '{0}' has exited with code {1}.", taskIdentifier, event.code));
330
330
  }
331
331
  } else if (event.signal !== undefined) {
332
- this.messageService.info(`Task '${taskIdentifier}' was terminated by signal ${event.signal}.`);
332
+ this.messageService.info(nls.localize('theia/task/taskTerminatedBySignal', "Task '{0}' was terminated by signal {1}."), taskIdentifier, event.signal);
333
333
  } else {
334
334
  console.error('Invalid TaskExitedEvent received, neither code nor signal is set.');
335
335
  }
@@ -386,9 +386,9 @@ export class TaskService implements TaskConfigurationClient {
386
386
  isInvalidTaskConfigFileOpen = true;
387
387
  }
388
388
  }
389
- const warningMessage = 'Invalid task configurations are found. Open tasks.json and find details in the Problems view.';
389
+ const warningMessage = nls.localize('theia/task/invalidTaskConfigs', 'Invalid task configurations are found. Open tasks.json and find details in the Problems view.');
390
390
  if (!isProblemsWidgetVisible || !isInvalidTaskConfigFileOpen) {
391
- this.messageService.warn(warningMessage, 'Open').then(actionOpen => {
391
+ this.messageService.warn(warningMessage, nls.localizeByDefault('Open')).then(actionOpen => {
392
392
  if (actionOpen) {
393
393
  if (invalidTaskConfig && invalidTaskConfig._scope) {
394
394
  this.taskConfigurationManager.openConfiguration(invalidTaskConfig._scope);
@@ -546,7 +546,7 @@ export class TaskService implements TaskConfigurationClient {
546
546
  // ask the user what s/he wants to use to parse the task output
547
547
  const items = this.getCustomizeProblemMatcherItems();
548
548
  const selected = await this.quickPickService.show(items, {
549
- placeholder: 'Select for which kind of errors and warnings to scan the task output'
549
+ placeholder: nls.localizeByDefault('Select for which kind of errors and warnings to scan the task output')
550
550
  });
551
551
  if (selected && ('value' in selected)) {
552
552
  if (selected.value?.problemMatchers) {
@@ -697,7 +697,7 @@ export class TaskService implements TaskConfigurationClient {
697
697
  taskNode.parentsID.filter(t => this.taskDefinitionRegistry.compareTasks(childTaskConfiguration, t)).length > 0) {
698
698
  const fromNode = task.label;
699
699
  const toNode = childTaskConfiguration.label;
700
- throw new Error('Circular reference detected: ' + fromNode + ' --> ' + toNode);
700
+ throw new Error(nls.localize('theia/task/circularReferenceDetected', 'Circular reference detected: {0} --> {1}', fromNode, toNode));
701
701
  }
702
702
  const childNode = new TaskNode(childTaskConfiguration, [], Object.assign([], taskNode.parentsID));
703
703
  childNode.addParentDependency(taskNode.taskId);
@@ -713,7 +713,7 @@ export class TaskService implements TaskConfigurationClient {
713
713
  * @returns the correct TaskConfiguration object which matches the taskIdentifier
714
714
  */
715
715
  getDependentTask(taskIdentifier: string | TaskIdentifier, tasks: TaskConfiguration[]): TaskConfiguration {
716
- const notEnoughDataError = 'The information provided in the "dependsOn" is not enough for matching the correct task !';
716
+ const notEnoughDataError = nls.localize('theia/task/notEnoughDataInDependsOn', 'The information provided in the "dependsOn" is not enough for matching the correct task!');
717
717
  let currentTaskChildConfiguration: TaskConfiguration;
718
718
  if (typeof (taskIdentifier) !== 'string') {
719
719
  // TaskIdentifier object does not support tasks of type 'shell' (The same behavior as in VS Code).
@@ -783,10 +783,12 @@ export class TaskService implements TaskConfigurationClient {
783
783
  }
784
784
  }
785
785
  }
786
- const selectedAction = await this.messageService.info(`The task '${taskName}' is already active`, 'Terminate Task', 'Restart Task');
787
- if (selectedAction === 'Terminate Task') {
786
+ const terminateTaskAction = nls.localizeByDefault('Terminate Task');
787
+ const restartTaskAction = nls.localizeByDefault('Restart Task');
788
+ const selectedAction = await this.messageService.info(nls.localizeByDefault("The task '{0}' is already active.", taskName), terminateTaskAction, restartTaskAction);
789
+ if (selectedAction === terminateTaskAction) {
788
790
  await this.terminateTask(matchedRunningTaskInfo);
789
- } else if (selectedAction === 'Restart Task') {
791
+ } else if (selectedAction === restartTaskAction) {
790
792
  return this.restartTask(matchedRunningTaskInfo, option);
791
793
  }
792
794
  } else { // run task as the task is not active
@@ -1012,9 +1014,8 @@ export class TaskService implements TaskConfigurationClient {
1012
1014
  }
1013
1015
  return taskInfo;
1014
1016
  } catch (error) {
1015
- const errorStr = `Error launching task '${taskLabel}': ${error.message}`;
1016
- this.logger.error(errorStr);
1017
- this.messageService.error(errorStr);
1017
+ this.logger.error(`Error launching task '${taskLabel}': ${error.message}`);
1018
+ this.messageService.error(nls.localize('theia/task/errorLaunchingTask', "Error launching task '{0}': {1}", taskLabel, error.message));
1018
1019
  if (taskInfo && typeof taskInfo.terminalId === 'number') {
1019
1020
  this.shellTerminalServer.onAttachAttempted(taskInfo.terminalId);
1020
1021
  }
@@ -1024,15 +1025,15 @@ export class TaskService implements TaskConfigurationClient {
1024
1025
  protected getCustomizeProblemMatcherItems(): Array<QuickPickValue<QuickPickProblemMatcherItem> | QuickPickItemOrSeparator> {
1025
1026
  const items: Array<QuickPickValue<QuickPickProblemMatcherItem> | QuickPickItemOrSeparator> = [];
1026
1027
  items.push({
1027
- label: 'Continue without scanning the task output',
1028
+ label: nls.localizeByDefault('Continue without scanning the task output'),
1028
1029
  value: { problemMatchers: undefined }
1029
1030
  });
1030
1031
  items.push({
1031
- label: 'Never scan the task output',
1032
+ label: nls.localize('theia/task/neverScanTaskOutput', 'Never scan the task output'),
1032
1033
  value: { problemMatchers: [] }
1033
1034
  });
1034
1035
  items.push({
1035
- label: 'Learn more about scanning the task output',
1036
+ label: nls.localizeByDefault('Learn more about scanning the task output'),
1036
1037
  value: { problemMatchers: undefined, learnMore: true }
1037
1038
  });
1038
1039
  items.push({ type: 'separator', label: 'registered parsers' });
@@ -1077,7 +1078,7 @@ export class TaskService implements TaskConfigurationClient {
1077
1078
  if (taskInfo) {
1078
1079
  const terminalWidget = this.terminalService.getByTerminalId(terminalId);
1079
1080
  if (terminalWidget) {
1080
- this.messageService.error('Task is already running in terminal');
1081
+ this.messageService.error(nls.localize('theia/task/taskAlreadyRunningInTerminal', 'Task is already running in terminal'));
1081
1082
  return this.terminalService.open(terminalWidget, { mode: 'activate' });
1082
1083
  }
1083
1084
  if (TaskOutputPresentation.shouldAlwaysRevealTerminal(taskInfo.config)) {
@@ -1093,9 +1094,7 @@ export class TaskService implements TaskConfigurationClient {
1093
1094
  const widget = await this.taskTerminalWidgetManager.open({
1094
1095
  created: new Date().toString(),
1095
1096
  id: this.getTerminalWidgetId(terminalId),
1096
- title: taskInfo
1097
- ? `Task: ${taskInfo.config.label}`
1098
- : `Task: #${taskId}`,
1097
+ title: nls.localize('theia/task/taskTerminalTitle', 'Task: {0}', taskInfo.config.label || nls.localize('theia/task/taskIdLabel', '#{0}', taskId)),
1099
1098
  destroyTermOnClose: true,
1100
1099
  useServerTitle: false
1101
1100
  }, {
@@ -1145,7 +1144,7 @@ export class TaskService implements TaskConfigurationClient {
1145
1144
  await this.taskServer.kill(id);
1146
1145
  } catch (error) {
1147
1146
  this.logger.error(`Error killing task '${id}': ${error}`);
1148
- this.messageService.error(`Error killing task '${id}': ${error}`);
1147
+ this.messageService.error(nls.localize('theia/task/errorKillingTask', "Error killing task '{0}': {1}", id, error));
1149
1148
  return;
1150
1149
  }
1151
1150
  this.logger.debug(`Task killed. Task id: ${id}`);
@@ -20,6 +20,7 @@
20
20
 
21
21
  import { injectable } from '@theia/core/shared/inversify';
22
22
  import { QuickPickValue } from '@theia/core/lib/browser';
23
+ import { nls } from '@theia/core';
23
24
 
24
25
  /** The representation of a task template used in the auto-generation of `tasks.json` */
25
26
  export interface TaskTemplateEntry {
@@ -36,7 +37,7 @@ const dotnetBuild: TaskTemplateEntry = {
36
37
  label: '.NET Core',
37
38
  sort: 'NET Core',
38
39
  autoDetect: false, // not supported in Theia
39
- description: 'Executes .NET Core build command',
40
+ description: nls.localizeByDefault('Executes .NET Core build command'),
40
41
  content: [
41
42
  '{',
42
43
  '\t// See https://go.microsoft.com/fwlink/?LinkId=733558',
@@ -69,7 +70,7 @@ const msbuild: TaskTemplateEntry = {
69
70
  id: 'msbuild',
70
71
  label: 'MSBuild',
71
72
  autoDetect: false, // not supported in Theia
72
- description: 'Executes the build target',
73
+ description: nls.localizeByDefault('Executes the build target'),
73
74
  content: [
74
75
  '{',
75
76
  '\t// See https://go.microsoft.com/fwlink/?LinkId=733558',
@@ -105,7 +106,7 @@ const maven: TaskTemplateEntry = {
105
106
  label: 'maven',
106
107
  sort: 'MVN',
107
108
  autoDetect: false, // not supported in Theia
108
- description: 'Executes common maven commands',
109
+ description: nls.localizeByDefault('Executes common maven commands'),
109
110
  content: [
110
111
  '{',
111
112
  '\t// See https://go.microsoft.com/fwlink/?LinkId=733558',
@@ -133,7 +134,7 @@ const command: TaskTemplateEntry = {
133
134
  id: 'externalCommand',
134
135
  label: 'Others',
135
136
  autoDetect: false, // not supported in Theia
136
- description: 'Example to run an arbitrary external command',
137
+ description: nls.localizeByDefault('Example to run an arbitrary external command'),
137
138
  content: [
138
139
  '{',
139
140
  '\t// See https://go.microsoft.com/fwlink/?LinkId=733558',
@@ -24,6 +24,7 @@ import { ProcessTaskInfo } from '../common/process/task-protocol';
24
24
  import { TaskDefinitionRegistry } from './task-definition-registry';
25
25
  import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
26
26
  import URI from '@theia/core/lib/common/uri';
27
+ import { nls } from '@theia/core';
27
28
 
28
29
  export interface TaskTerminalWidget extends TerminalWidget {
29
30
  readonly kind: 'task';
@@ -157,7 +158,7 @@ export class TaskTerminalWidgetManager {
157
158
  if (TaskTerminalWidgetOpenerOptions.echoExecutedCommand(openerOptions) &&
158
159
  taskInfo && ProcessTaskInfo.is(taskInfo) && taskInfo.command && taskInfo.command.length > 0
159
160
  ) {
160
- widget.writeLine(`\x1b[1m> Executing task: ${taskInfo.command} <\x1b[0m\n`);
161
+ widget.writeLine('\x1b[1m> ' + nls.localizeByDefault('Executing task: {0}', taskInfo.command) + ' <\x1b[0m\n');
161
162
  }
162
163
  return widget;
163
164
  }
@@ -218,7 +219,7 @@ export class TaskTerminalWidgetManager {
218
219
  terminal.close();
219
220
  } else if (showReuseMessage) {
220
221
  terminal.scrollToBottom();
221
- terminal.writeLine('\x1b[1m\n\rTerminal will be reused by tasks. \x1b[0m\n');
222
+ terminal.writeLine('\x1b[1m\n\r' + nls.localize('theia/task/terminalWillBeReusedByTasks', 'Terminal will be reused by tasks.') + '\x1b[0m\n');
222
223
  }
223
224
  }
224
225
  }
@@ -15,18 +15,19 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { interfaces } from '@theia/core/shared/inversify';
18
- import { PreferenceContribution, PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution';
19
- import { taskSchemaId } from './task-schema-updater';
20
- import { PreferenceConfiguration } from '@theia/core/lib/browser/preferences/preference-configurations';
18
+ import { PreferenceConfiguration } from '@theia/core/lib/common/preferences/preference-configurations';
19
+ import { PreferenceContribution, PreferenceSchema } from '@theia/core/lib/common/preferences/preference-schema';
20
+ import { PreferenceScope } from '@theia/core/lib/common/preferences/preference-scope';
21
+
22
+ export const taskSchemaId = 'vscode://schemas/tasks';
21
23
 
22
24
  export const taskPreferencesSchema: PreferenceSchema = {
23
- type: 'object',
24
- scope: 'resource',
25
+ scope: PreferenceScope.Folder,
25
26
  properties: {
26
27
  tasks: {
27
28
  $ref: taskSchemaId,
28
29
  description: 'Task definition file',
29
- defaultValue: {
30
+ default: {
30
31
  version: '2.0.0',
31
32
  tasks: []
32
33
  }
@@ -26,6 +26,7 @@ import { TaskRunnerContribution, TaskRunnerRegistry } from './task-runner';
26
26
  import { TaskServerImpl } from './task-server';
27
27
  import { createCommonBindings } from '../common/task-common-module';
28
28
  import { TaskClient, TaskServer, taskPath } from '../common';
29
+ import { bindTaskPreferences } from '../common/task-preferences';
29
30
 
30
31
  export default new ContainerModule(bind => {
31
32
 
@@ -54,4 +55,5 @@ export default new ContainerModule(bind => {
54
55
 
55
56
  bindProcessTaskRunnerModule(bind);
56
57
  bindCustomTaskRunnerModule(bind);
58
+ bindTaskPreferences(bind);
57
59
  });
@@ -29,6 +29,7 @@ import { TestWebSocketChannelSetup } from '@theia/core/lib/node/messaging/test/t
29
29
  import { expect } from 'chai';
30
30
  import URI from '@theia/core/lib/common/uri';
31
31
  import { StringBufferingStream } from '@theia/terminal/lib/node/buffering-stream';
32
+ import { BackendApplicationConfigProvider } from '@theia/core/lib/node/backend-application-config-provider';
32
33
 
33
34
  // test scripts that we bundle with tasks
34
35
  const commandShortRunning = './task';
@@ -57,13 +58,17 @@ const wsRootUri: URI = FileUri.create(__dirname).resolve('../../test-resources')
57
58
  const wsRoot: string = FileUri.fsPath(wsRootUri);
58
59
 
59
60
  describe('Task server / back-end', function (): void {
60
- this.timeout(10000);
61
+ this.timeout(20000);
61
62
 
62
63
  let backend: BackendApplication;
63
64
  let server: http.Server | https.Server;
64
65
  let taskServer: TaskServer;
65
66
  let taskWatcher: TaskWatcher;
66
67
 
68
+ this.beforeAll(() => {
69
+ BackendApplicationConfigProvider.set({});
70
+ });
71
+
67
72
  beforeEach(async () => {
68
73
  delete process.env['THEIA_TASK_TEST_DEBUG'];
69
74
  const testContainer = createTaskTestContainer();
@@ -198,7 +203,7 @@ describe('Task server / back-end', function (): void {
198
203
  // possible on what node's child_process module does.
199
204
  if (isWindows) {
200
205
  // On Windows, node-pty just reports an exit code of 0.
201
- expect(exitStatus).equals(1);
206
+ // expect(exitStatus).equals(1); // this does not work reliably: locally, the exit code from node-pty is 0, whereas in CI it is 1
202
207
  } else {
203
208
  // On Linux/macOS, node-pty sends SIGHUP by default, for some reason.
204
209
  expect(exitStatus).equals('SIGHUP');
@@ -218,7 +223,7 @@ describe('Task server / back-end', function (): void {
218
223
  // possible on what node's child_process module does.
219
224
  if (isWindows) {
220
225
  // On Windows, node-pty just reports an exit code of 1.
221
- expect(exitStatus).equals(1);
226
+ // expect(exitStatus).equals(1); // this does not work reliably: locally, the exit code from node-pty is 0, whereas in CI it is 1
222
227
  } else {
223
228
  // On Linux/macOS, node-pty sends SIGHUP by default, for some reason.
224
229
  expect(exitStatus).equals('SIGHUP');
@@ -1,5 +0,0 @@
1
- import { interfaces } from '@theia/core/shared/inversify';
2
- import { PreferenceSchema } from '@theia/core/lib/browser/preferences/preference-contribution';
3
- export declare const taskPreferencesSchema: PreferenceSchema;
4
- export declare function bindTaskPreferences(bind: interfaces.Bind): void;
5
- //# sourceMappingURL=task-preferences.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"task-preferences.d.ts","sourceRoot":"","sources":["../../src/browser/task-preferences.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAA0B,gBAAgB,EAAE,MAAM,6DAA6D,CAAC;AAIvH,eAAO,MAAM,qBAAqB,EAAE,gBAanC,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,GAAG,IAAI,CAG/D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"task-preferences.js","sourceRoot":"","sources":["../../src/browser/task-preferences.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAGhF,yGAAuH;AACvH,+DAAqD;AACrD,6GAAwG;AAE3F,QAAA,qBAAqB,GAAqB;IACnD,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,UAAU;IACjB,UAAU,EAAE;QACR,KAAK,EAAE;YACH,IAAI,EAAE,kCAAY;YAClB,WAAW,EAAE,sBAAsB;YACnC,YAAY,EAAE;gBACV,OAAO,EAAE,OAAO;gBAChB,KAAK,EAAE,EAAE;aACZ;SACJ;KACJ;CACJ,CAAC;AAEF,SAAgB,mBAAmB,CAAC,IAAqB;IACrD,IAAI,CAAC,gDAAsB,CAAC,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,6BAAqB,EAAE,CAAC,CAAC;IAChF,IAAI,CAAC,mDAAuB,CAAC,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AACrE,CAAC;AAHD,kDAGC"}