@codingame/monaco-vscode-extensions-service-override 4.5.1 → 5.0.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 (52) hide show
  1. package/extensions.js +0 -2
  2. package/package.json +3 -3
  3. package/vscode/src/vs/base/common/console.js +1 -1
  4. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +69 -136
  5. package/vscode/src/vs/platform/extensionResourceLoader/browser/extensionResourceLoaderService.js +1 -1
  6. package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +32 -37
  7. package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +20 -2
  8. package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +12 -11
  9. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +34 -10
  10. package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js +1 -1
  11. package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +1 -1
  12. package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +44 -38
  13. package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +60 -66
  14. package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +3 -3
  15. package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +6 -6
  16. package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +10 -9
  17. package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +1 -1
  18. package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +45 -21
  19. package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +1 -1
  20. package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +41 -50
  21. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +1 -1
  22. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +53 -100
  23. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +30 -13
  24. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +32 -41
  25. package/vscode/src/vs/workbench/api/browser/mainThreadLogService.js +2 -2
  26. package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +47 -56
  27. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +3 -1
  28. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +5 -5
  29. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +7 -10
  30. package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +11 -12
  31. package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +8 -11
  32. package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +3 -3
  33. package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +185 -165
  34. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalShellIntegration.js +38 -10
  35. package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +1 -0
  36. package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +1 -1
  37. package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +28 -30
  38. package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +23 -23
  39. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.js +3 -3
  40. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewViews.js +3 -3
  41. package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +19 -18
  42. package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +36 -33
  43. package/vscode/src/vs/workbench/api/common/shared/dataTransferCache.js +2 -2
  44. package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionBisect.js +56 -121
  45. package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +1 -1
  46. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.js +5 -5
  47. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +133 -144
  48. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +34 -33
  49. package/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.js +9 -8
  50. package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.js +2 -5
  51. package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +0 -70
  52. package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +0 -50
@@ -4,6 +4,7 @@ import { URI } from 'vscode/vscode/vs/base/common/uri';
4
4
  import { generateUuid } from 'vscode/vscode/vs/base/common/uuid';
5
5
  import { isString } from 'vscode/vscode/vs/base/common/types';
6
6
  import { platform } from 'vscode/vscode/vs/base/common/platform';
7
+ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
7
8
  import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
8
9
  import { TaskDefinition, PresentationOptions, RunOptions, CommandOptions, RuntimeType, TaskSourceKind, CustomTask, ContributedTask, ConfiguringTask } from 'vscode/vscode/vs/workbench/contrib/tasks/common/tasks';
9
10
  import { ITaskService } from 'vscode/vscode/vs/workbench/contrib/tasks/common/taskService.service';
@@ -12,8 +13,9 @@ import { ExtHostContext, MainContext } from 'vscode/vscode/vs/workbench/api/comm
12
13
  import { IConfigurationResolverService } from 'vscode/vscode/vs/workbench/services/configurationResolver/common/configurationResolver.service';
13
14
  import { ErrorNoTelemetry } from 'vscode/vscode/vs/base/common/errors';
14
15
 
16
+ const _moduleId = "vs/workbench/api/browser/mainThreadTask";
15
17
  var TaskExecutionDTO;
16
- ( (function(TaskExecutionDTO) {
18
+ ( ((function(TaskExecutionDTO) {
17
19
  function from(value) {
18
20
  return {
19
21
  id: value.id,
@@ -21,9 +23,9 @@ var TaskExecutionDTO;
21
23
  };
22
24
  }
23
25
  TaskExecutionDTO.from = from;
24
- })(TaskExecutionDTO || (TaskExecutionDTO = {})));
26
+ })(TaskExecutionDTO || (TaskExecutionDTO = {}))));
25
27
  var TaskProcessStartedDTO;
26
- ( (function(TaskProcessStartedDTO) {
28
+ ( ((function(TaskProcessStartedDTO) {
27
29
  function from(value, processId) {
28
30
  return {
29
31
  id: value.id,
@@ -31,9 +33,9 @@ var TaskProcessStartedDTO;
31
33
  };
32
34
  }
33
35
  TaskProcessStartedDTO.from = from;
34
- })(TaskProcessStartedDTO || (TaskProcessStartedDTO = {})));
36
+ })(TaskProcessStartedDTO || (TaskProcessStartedDTO = {}))));
35
37
  var TaskProcessEndedDTO;
36
- ( (function(TaskProcessEndedDTO) {
38
+ ( ((function(TaskProcessEndedDTO) {
37
39
  function from(value, exitCode) {
38
40
  return {
39
41
  id: value.id,
@@ -41,9 +43,9 @@ var TaskProcessEndedDTO;
41
43
  };
42
44
  }
43
45
  TaskProcessEndedDTO.from = from;
44
- })(TaskProcessEndedDTO || (TaskProcessEndedDTO = {})));
46
+ })(TaskProcessEndedDTO || (TaskProcessEndedDTO = {}))));
45
47
  var TaskDefinitionDTO;
46
- ( (function(TaskDefinitionDTO) {
48
+ ( ((function(TaskDefinitionDTO) {
47
49
  function from(value) {
48
50
  const result = Object.assign(Object.create(null), value);
49
51
  delete result._key;
@@ -61,9 +63,9 @@ var TaskDefinitionDTO;
61
63
  return result;
62
64
  }
63
65
  TaskDefinitionDTO.to = to;
64
- })(TaskDefinitionDTO || (TaskDefinitionDTO = {})));
66
+ })(TaskDefinitionDTO || (TaskDefinitionDTO = {}))));
65
67
  var TaskPresentationOptionsDTO;
66
- ( (function(TaskPresentationOptionsDTO) {
68
+ ( ((function(TaskPresentationOptionsDTO) {
67
69
  function from(value) {
68
70
  if (value === undefined || value === null) {
69
71
  return undefined;
@@ -78,9 +80,9 @@ var TaskPresentationOptionsDTO;
78
80
  return Object.assign(Object.create(null), PresentationOptions.defaults, value);
79
81
  }
80
82
  TaskPresentationOptionsDTO.to = to;
81
- })(TaskPresentationOptionsDTO || (TaskPresentationOptionsDTO = {})));
83
+ })(TaskPresentationOptionsDTO || (TaskPresentationOptionsDTO = {}))));
82
84
  var RunOptionsDTO;
83
- ( (function(RunOptionsDTO) {
85
+ ( ((function(RunOptionsDTO) {
84
86
  function from(value) {
85
87
  if (value === undefined || value === null) {
86
88
  return undefined;
@@ -95,9 +97,9 @@ var RunOptionsDTO;
95
97
  return Object.assign(Object.create(null), RunOptions.defaults, value);
96
98
  }
97
99
  RunOptionsDTO.to = to;
98
- })(RunOptionsDTO || (RunOptionsDTO = {})));
100
+ })(RunOptionsDTO || (RunOptionsDTO = {}))));
99
101
  var ProcessExecutionOptionsDTO;
100
- ( (function(ProcessExecutionOptionsDTO) {
102
+ ( ((function(ProcessExecutionOptionsDTO) {
101
103
  function from(value) {
102
104
  if (value === undefined || value === null) {
103
105
  return undefined;
@@ -118,9 +120,9 @@ var ProcessExecutionOptionsDTO;
118
120
  };
119
121
  }
120
122
  ProcessExecutionOptionsDTO.to = to;
121
- })(ProcessExecutionOptionsDTO || (ProcessExecutionOptionsDTO = {})));
123
+ })(ProcessExecutionOptionsDTO || (ProcessExecutionOptionsDTO = {}))));
122
124
  var ProcessExecutionDTO;
123
- ( (function(ProcessExecutionDTO) {
125
+ ( ((function(ProcessExecutionDTO) {
124
126
  function is(value) {
125
127
  const candidate = value;
126
128
  return candidate && !!candidate.process;
@@ -128,7 +130,7 @@ var ProcessExecutionDTO;
128
130
  ProcessExecutionDTO.is = is;
129
131
  function from(value) {
130
132
  const process = isString(value.name) ? value.name : value.name.value;
131
- const args = value.args ? ( value.args.map(value => isString(value) ? value : value.value)) : [];
133
+ const args = value.args ? ( (value.args.map(value => isString(value) ? value : value.value))) : [];
132
134
  const result = {
133
135
  process: process,
134
136
  args: args
@@ -150,9 +152,9 @@ var ProcessExecutionDTO;
150
152
  return result;
151
153
  }
152
154
  ProcessExecutionDTO.to = to;
153
- })(ProcessExecutionDTO || (ProcessExecutionDTO = {})));
155
+ })(ProcessExecutionDTO || (ProcessExecutionDTO = {}))));
154
156
  var ShellExecutionOptionsDTO;
155
- ( (function(ShellExecutionOptionsDTO) {
157
+ ( ((function(ShellExecutionOptionsDTO) {
156
158
  function from(value) {
157
159
  if (value === undefined || value === null) {
158
160
  return undefined;
@@ -191,9 +193,9 @@ var ShellExecutionOptionsDTO;
191
193
  return result;
192
194
  }
193
195
  ShellExecutionOptionsDTO.to = to;
194
- })(ShellExecutionOptionsDTO || (ShellExecutionOptionsDTO = {})));
196
+ })(ShellExecutionOptionsDTO || (ShellExecutionOptionsDTO = {}))));
195
197
  var ShellExecutionDTO;
196
- ( (function(ShellExecutionDTO) {
198
+ ( ((function(ShellExecutionDTO) {
197
199
  function is(value) {
198
200
  const candidate = value;
199
201
  return candidate && (!!candidate.commandLine || !!candidate.command);
@@ -227,9 +229,9 @@ var ShellExecutionDTO;
227
229
  return result;
228
230
  }
229
231
  ShellExecutionDTO.to = to;
230
- })(ShellExecutionDTO || (ShellExecutionDTO = {})));
232
+ })(ShellExecutionDTO || (ShellExecutionDTO = {}))));
231
233
  var CustomExecutionDTO;
232
- ( (function(CustomExecutionDTO) {
234
+ ( ((function(CustomExecutionDTO) {
233
235
  function is(value) {
234
236
  const candidate = value;
235
237
  return candidate && candidate.customExecution === 'customExecution';
@@ -248,9 +250,9 @@ var CustomExecutionDTO;
248
250
  };
249
251
  }
250
252
  CustomExecutionDTO.to = to;
251
- })(CustomExecutionDTO || (CustomExecutionDTO = {})));
253
+ })(CustomExecutionDTO || (CustomExecutionDTO = {}))));
252
254
  var TaskSourceDTO;
253
- ( (function(TaskSourceDTO) {
255
+ ( ((function(TaskSourceDTO) {
254
256
  function from(value) {
255
257
  const result = {
256
258
  label: value.label
@@ -301,17 +303,17 @@ var TaskSourceDTO;
301
303
  return result;
302
304
  }
303
305
  TaskSourceDTO.to = to;
304
- })(TaskSourceDTO || (TaskSourceDTO = {})));
306
+ })(TaskSourceDTO || (TaskSourceDTO = {}))));
305
307
  var TaskHandleDTO;
306
- ( (function(TaskHandleDTO) {
308
+ ( ((function(TaskHandleDTO) {
307
309
  function is(value) {
308
310
  const candidate = value;
309
311
  return candidate && isString(candidate.id) && !!candidate.workspaceFolder;
310
312
  }
311
313
  TaskHandleDTO.is = is;
312
- })(TaskHandleDTO || (TaskHandleDTO = {})));
314
+ })(TaskHandleDTO || (TaskHandleDTO = {}))));
313
315
  var TaskDTO;
314
- ( (function(TaskDTO) {
316
+ ( ((function(TaskDTO) {
315
317
  function from(task) {
316
318
  if (task === undefined || task === null || (!CustomTask.is(task) && !ContributedTask.is(task) && !ConfiguringTask.is(task))) {
317
319
  return undefined;
@@ -376,32 +378,36 @@ var TaskDTO;
376
378
  }
377
379
  command.presentation = TaskPresentationOptionsDTO.to(task.presentationOptions);
378
380
  const source = TaskSourceDTO.to(task.source, workspace);
379
- const label = ( localizeWithPath(
380
- 'vs/workbench/api/browser/mainThreadTask',
381
- 'task.label',
382
- '{0}: {1}',
383
- source.label,
384
- task.name
385
- ));
381
+ const label = ( localizeWithPath(_moduleId, 0, '{0}: {1}', source.label, task.name));
386
382
  const definition = TaskDefinitionDTO.to(task.definition, executeOnly);
387
383
  const id = (CustomExecutionDTO.is(task.execution) && task._id) ? task._id : `${task.source.extensionId}.${definition._key}`;
388
- const result = ( new ContributedTask(
389
- id, source, label, definition.type, definition, command, task.hasDefinedMatchers, RunOptionsDTO.to(task.runOptions), {
390
- name: task.name,
391
- identifier: label,
392
- group: task.group,
393
- isBackground: !!task.isBackground,
394
- problemMatchers: task.problemMatchers.slice(),
395
- detail: task.detail,
396
- icon,
397
- hide
398
- }));
384
+ const result = ( (new
385
+ ContributedTask(
386
+ id,
387
+ source,
388
+ label,
389
+ definition.type,
390
+ definition,
391
+ command,
392
+ task.hasDefinedMatchers,
393
+ RunOptionsDTO.to(task.runOptions),
394
+ {
395
+ name: task.name,
396
+ identifier: label,
397
+ group: task.group,
398
+ isBackground: !!task.isBackground,
399
+ problemMatchers: task.problemMatchers.slice(),
400
+ detail: task.detail,
401
+ icon,
402
+ hide
403
+ }
404
+ )));
399
405
  return result;
400
406
  }
401
407
  TaskDTO.to = to;
402
- })(TaskDTO || (TaskDTO = {})));
408
+ })(TaskDTO || (TaskDTO = {}))));
403
409
  var TaskGroupDTO;
404
- ( (function(TaskGroupDTO) {
410
+ ( ((function(TaskGroupDTO) {
405
411
  function from(value) {
406
412
  if (value === undefined) {
407
413
  return undefined;
@@ -412,9 +418,9 @@ var TaskGroupDTO;
412
418
  };
413
419
  }
414
420
  TaskGroupDTO.from = from;
415
- })(TaskGroupDTO || (TaskGroupDTO = {})));
421
+ })(TaskGroupDTO || (TaskGroupDTO = {}))));
416
422
  var TaskFilterDTO;
417
- ( (function(TaskFilterDTO) {
423
+ ( ((function(TaskFilterDTO) {
418
424
  function from(value) {
419
425
  return value;
420
426
  }
@@ -423,15 +429,16 @@ var TaskFilterDTO;
423
429
  return value;
424
430
  }
425
431
  TaskFilterDTO.to = to;
426
- })(TaskFilterDTO || (TaskFilterDTO = {})));
427
- let MainThreadTask = class MainThreadTask {
432
+ })(TaskFilterDTO || (TaskFilterDTO = {}))));
433
+ let MainThreadTask = class MainThreadTask extends Disposable {
428
434
  constructor(extHostContext, _taskService, _workspaceContextServer, _configurationResolverService) {
435
+ super();
429
436
  this._taskService = _taskService;
430
437
  this._workspaceContextServer = _workspaceContextServer;
431
438
  this._configurationResolverService = _configurationResolverService;
432
- this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostTask));
433
- this._providers = ( new Map());
434
- this._taskService.onDidStateChange(async (event) => {
439
+ this._proxy = ( (extHostContext.getProxy(ExtHostContext.ExtHostTask)));
440
+ this._providers = ( (new Map()));
441
+ this._register(this._taskService.onDidStateChange(async (event) => {
435
442
  if (event.kind === "changed" ) {
436
443
  return;
437
444
  }
@@ -457,24 +464,27 @@ let MainThreadTask = class MainThreadTask {
457
464
  else if (event.kind === "end" ) {
458
465
  this._proxy.$OnDidEndTask(TaskExecutionDTO.from(task.getTaskExecution()));
459
466
  }
460
- });
467
+ }));
461
468
  }
462
469
  dispose() {
463
- for (const value of ( this._providers.values())) {
470
+ for (const value of ( (this._providers.values()))) {
464
471
  value.disposable.dispose();
465
472
  }
466
473
  this._providers.clear();
474
+ super.dispose();
467
475
  }
468
476
  $createTaskId(taskDTO) {
469
- return ( new Promise((resolve, reject) => {
470
- const task = TaskDTO.to(taskDTO, this._workspaceContextServer, true);
471
- if (task) {
472
- resolve(task._id);
473
- }
474
- else {
475
- reject(( new Error('Task could not be created from DTO')));
476
- }
477
- }));
477
+ return (
478
+ (new Promise((resolve, reject) => {
479
+ const task = TaskDTO.to(taskDTO, this._workspaceContextServer, true);
480
+ if (task) {
481
+ resolve(task._id);
482
+ }
483
+ else {
484
+ reject(( (new Error('Task could not be created from DTO'))));
485
+ }
486
+ }))
487
+ );
478
488
  }
479
489
  $registerTaskProvider(handle, type) {
480
490
  const provider = {
@@ -542,7 +552,7 @@ let MainThreadTask = class MainThreadTask {
542
552
  else {
543
553
  const workspaceObject = this._workspaceContextServer.getWorkspace();
544
554
  const uri = URI.revive(value);
545
- if (workspaceObject.configuration?.toString() === ( uri.toString())) {
555
+ if (workspaceObject.configuration?.toString() === ( (uri.toString()))) {
546
556
  workspace = workspaceObject;
547
557
  }
548
558
  else {
@@ -562,10 +572,10 @@ let MainThreadTask = class MainThreadTask {
562
572
  task: TaskDTO.from(task)
563
573
  };
564
574
  }
565
- throw new Error('Task not found');
575
+ throw ( (new Error('Task not found')));
566
576
  }
567
577
  else {
568
- throw new Error('No workspace folder');
578
+ throw ( (new Error('No workspace folder')));
569
579
  }
570
580
  }
571
581
  else {
@@ -577,80 +587,86 @@ let MainThreadTask = class MainThreadTask {
577
587
  }
578
588
  }
579
589
  $executeTask(value) {
580
- return ( new Promise((resolve, reject) => {
581
- if (TaskHandleDTO.is(value)) {
582
- const workspace = this.getWorkspace(value.workspaceFolder);
583
- if (workspace) {
584
- this._taskService.getTask(workspace, value.id, true).then((task) => {
585
- if (!task) {
586
- reject(( new Error('Task not found')));
587
- }
588
- else {
589
- const result = {
590
- id: value.id,
591
- task: TaskDTO.from(task)
592
- };
593
- this._taskService.run(task).then(summary => {
594
- if ((summary?.exitCode === undefined) || (summary.exitCode !== 0)) {
595
- this._proxy.$OnDidEndTask(result);
596
- }
597
- }, reason => {
598
- });
599
- resolve(result);
600
- }
601
- }, (_error) => {
602
- reject(( new Error('Task not found')));
603
- });
590
+ return (
591
+ (new Promise((resolve, reject) => {
592
+ if (TaskHandleDTO.is(value)) {
593
+ const workspace = this.getWorkspace(value.workspaceFolder);
594
+ if (workspace) {
595
+ this._taskService.getTask(workspace, value.id, true).then((task) => {
596
+ if (!task) {
597
+ reject(( (new Error('Task not found'))));
598
+ }
599
+ else {
600
+ const result = {
601
+ id: value.id,
602
+ task: TaskDTO.from(task)
603
+ };
604
+ this._taskService.run(task).then(summary => {
605
+ if ((summary?.exitCode === undefined) || (summary.exitCode !== 0)) {
606
+ this._proxy.$OnDidEndTask(result);
607
+ }
608
+ }, reason => {
609
+ });
610
+ resolve(result);
611
+ }
612
+ }, (_error) => {
613
+ reject(( (new Error('Task not found'))));
614
+ });
615
+ }
616
+ else {
617
+ reject(( (new Error('No workspace folder'))));
618
+ }
604
619
  }
605
620
  else {
606
- reject(( new Error('No workspace folder')));
621
+ const task = TaskDTO.to(value, this._workspaceContextServer, true);
622
+ this._taskService.run(task).then(undefined, reason => {
623
+ });
624
+ const result = {
625
+ id: task._id,
626
+ task: TaskDTO.from(task)
627
+ };
628
+ resolve(result);
607
629
  }
608
- }
609
- else {
610
- const task = TaskDTO.to(value, this._workspaceContextServer, true);
611
- this._taskService.run(task).then(undefined, reason => {
612
- });
613
- const result = {
614
- id: task._id,
615
- task: TaskDTO.from(task)
616
- };
617
- resolve(result);
618
- }
619
- }));
630
+ }))
631
+ );
620
632
  }
621
633
  $customExecutionComplete(id, result) {
622
- return ( new Promise((resolve, reject) => {
623
- this._taskService.getActiveTasks().then((tasks) => {
624
- for (const task of tasks) {
625
- if (id === task._id) {
626
- this._taskService.extensionCallbackTaskComplete(task, result).then((value) => {
627
- resolve(undefined);
628
- }, (error) => {
629
- reject(error);
630
- });
631
- return;
634
+ return (
635
+ (new Promise((resolve, reject) => {
636
+ this._taskService.getActiveTasks().then((tasks) => {
637
+ for (const task of tasks) {
638
+ if (id === task._id) {
639
+ this._taskService.extensionCallbackTaskComplete(task, result).then((value) => {
640
+ resolve(undefined);
641
+ }, (error) => {
642
+ reject(error);
643
+ });
644
+ return;
645
+ }
632
646
  }
633
- }
634
- reject(( new Error('Task to mark as complete not found')));
635
- });
636
- }));
647
+ reject(( (new Error('Task to mark as complete not found'))));
648
+ });
649
+ }))
650
+ );
637
651
  }
638
652
  $terminateTask(id) {
639
- return ( new Promise((resolve, reject) => {
640
- this._taskService.getActiveTasks().then((tasks) => {
641
- for (const task of tasks) {
642
- if (id === task._id) {
643
- this._taskService.terminate(task).then((value) => {
644
- resolve(undefined);
645
- }, (error) => {
646
- reject(undefined);
647
- });
648
- return;
653
+ return (
654
+ (new Promise((resolve, reject) => {
655
+ this._taskService.getActiveTasks().then((tasks) => {
656
+ for (const task of tasks) {
657
+ if (id === task._id) {
658
+ this._taskService.terminate(task).then((value) => {
659
+ resolve(undefined);
660
+ }, (error) => {
661
+ reject(undefined);
662
+ });
663
+ return;
664
+ }
649
665
  }
650
- }
651
- reject(( new ErrorNoTelemetry('Task to terminate not found')));
652
- });
653
- }));
666
+ reject(( (new ErrorNoTelemetry('Task to terminate not found'))));
667
+ });
668
+ }))
669
+ );
654
670
  }
655
671
  $registerTaskSystem(key, info) {
656
672
  let platform$1;
@@ -673,43 +689,47 @@ let MainThreadTask = class MainThreadTask {
673
689
  this._taskService.registerTaskSystem(key, {
674
690
  platform: platform$1,
675
691
  uriProvider: (path) => {
676
- return ( URI.from({ scheme: info.scheme, authority: info.authority, path }));
692
+ return (
693
+ (URI.from({ scheme: info.scheme, authority: info.authority, path }))
694
+ );
677
695
  },
678
696
  context: this._extHostContext,
679
697
  resolveVariables: (workspaceFolder, toResolve, target) => {
680
698
  const vars = [];
681
699
  toResolve.variables.forEach(item => vars.push(item));
682
700
  return Promise.resolve(this._proxy.$resolveVariables(workspaceFolder.uri, { process: toResolve.process, variables: vars })).then(values => {
683
- const partiallyResolvedVars = Array.from(( Object.values(values.variables)));
684
- return ( new Promise((resolve, reject) => {
685
- this._configurationResolverService.resolveWithInteraction(workspaceFolder, partiallyResolvedVars, 'tasks', undefined, target).then(resolvedVars => {
686
- if (!resolvedVars) {
687
- resolve(undefined);
688
- }
689
- const result = {
690
- process: undefined,
691
- variables: ( new Map())
692
- };
693
- for (let i = 0; i < partiallyResolvedVars.length; i++) {
694
- const variableName = vars[i].substring(2, vars[i].length - 1);
695
- if (resolvedVars && values.variables[vars[i]] === vars[i]) {
696
- const resolved = resolvedVars.get(variableName);
697
- if (typeof resolved === 'string') {
698
- result.variables.set(variableName, resolved);
701
+ const partiallyResolvedVars = Array.from(( (Object.values(values.variables))));
702
+ return (
703
+ (new Promise((resolve, reject) => {
704
+ this._configurationResolverService.resolveWithInteraction(workspaceFolder, partiallyResolvedVars, 'tasks', undefined, target).then(resolvedVars => {
705
+ if (!resolvedVars) {
706
+ resolve(undefined);
707
+ }
708
+ const result = {
709
+ process: undefined,
710
+ variables: ( (new Map()))
711
+ };
712
+ for (let i = 0; i < partiallyResolvedVars.length; i++) {
713
+ const variableName = vars[i].substring(2, vars[i].length - 1);
714
+ if (resolvedVars && values.variables[vars[i]] === vars[i]) {
715
+ const resolved = resolvedVars.get(variableName);
716
+ if (typeof resolved === 'string') {
717
+ result.variables.set(variableName, resolved);
718
+ }
719
+ }
720
+ else {
721
+ result.variables.set(variableName, partiallyResolvedVars[i]);
699
722
  }
700
723
  }
701
- else {
702
- result.variables.set(variableName, partiallyResolvedVars[i]);
724
+ if (isString(values.process)) {
725
+ result.process = values.process;
703
726
  }
704
- }
705
- if (isString(values.process)) {
706
- result.process = values.process;
707
- }
708
- resolve(result);
709
- }, reason => {
710
- reject(reason);
711
- });
712
- }));
727
+ resolve(result);
728
+ }, reason => {
729
+ reject(reason);
730
+ });
731
+ }))
732
+ );
713
733
  });
714
734
  },
715
735
  findExecutable: (command, cwd, paths) => {
@@ -723,9 +743,9 @@ let MainThreadTask = class MainThreadTask {
723
743
  };
724
744
  MainThreadTask = __decorate([
725
745
  extHostNamedCustomer(MainContext.MainThreadTask),
726
- ( __param(1, ITaskService)),
727
- ( __param(2, IWorkspaceContextService)),
728
- ( __param(3, IConfigurationResolverService))
746
+ ( (__param(1, ITaskService))),
747
+ ( (__param(2, IWorkspaceContextService))),
748
+ ( (__param(3, IConfigurationResolverService)))
729
749
  ], MainThreadTask);
730
750
 
731
751
  export { MainThreadTask };
@@ -1,21 +1,29 @@
1
1
  import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
2
  import { Event } from 'vscode/vscode/vs/base/common/event';
3
- import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
3
+ import { Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
4
+ import { URI } from 'vscode/vscode/vs/base/common/uri';
4
5
  import { ExtHostContext, MainContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
5
6
  import { ITerminalService } from 'vscode/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
6
7
  import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
7
8
  import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
9
+ import { TerminalShellExecutionCommandLineConfidence } from 'vscode/vscode/vs/workbench/api/common/extHostTypes';
8
10
 
9
11
  let MainThreadTerminalShellIntegration = class MainThreadTerminalShellIntegration extends Disposable {
10
12
  constructor(extHostContext, _terminalService, workbenchEnvironmentService) {
11
13
  super();
12
14
  this._terminalService = _terminalService;
13
15
  this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostTerminalShellIntegration));
14
- const onDidAddCommandDetection = this._terminalService.createOnInstanceEvent(instance => {
16
+ const instanceDataListeners = ( new Map());
17
+ this._register(toDisposable(() => {
18
+ for (const listener of ( instanceDataListeners.values())) {
19
+ listener.dispose();
20
+ }
21
+ }));
22
+ const onDidAddCommandDetection = this._store.add(this._terminalService.createOnInstanceEvent(instance => {
15
23
  return ( Event.map(Event.filter(instance.capabilities.onDidAddCapabilityType, e => {
16
24
  return e === 2 ;
17
- }, this._store), () => instance));
18
- });
25
+ }), () => instance));
26
+ })).event;
19
27
  this._store.add(onDidAddCommandDetection(e => this._proxy.$shellIntegrationChange(e.instanceId)));
20
28
  const commandDetectionStartEvent = this._store.add(this._terminalService.createOnInstanceCapabilityEvent(2 , e => e.onCommandExecuted));
21
29
  let currentCommand;
@@ -24,28 +32,48 @@ let MainThreadTerminalShellIntegration = class MainThreadTerminalShellIntegratio
24
32
  return;
25
33
  }
26
34
  currentCommand = e.data;
27
- this._proxy.$shellExecutionStart(e.instance.instanceId, e.data.command, e.data.cwd);
35
+ const instanceId = e.instance.instanceId;
36
+ this._proxy.$shellExecutionStart(instanceId, e.data.command, convertToExtHostCommandLineConfidence(e.data), e.data.isTrusted, this._convertCwdToUri(e.data.cwd));
37
+ instanceDataListeners.get(instanceId)?.dispose();
38
+ instanceDataListeners.set(instanceId, Event.accumulate(e.instance.onData, 50, this._store)(events => this._proxy.$shellExecutionData(instanceId, events.join())));
28
39
  }));
29
40
  const commandDetectionEndEvent = this._store.add(this._terminalService.createOnInstanceCapabilityEvent(2 , e => e.onCommandFinished));
30
41
  this._store.add(commandDetectionEndEvent.event(e => {
31
42
  currentCommand = undefined;
32
- this._proxy.$shellExecutionEnd(e.instance.instanceId, e.data.command, e.data.exitCode);
43
+ const instanceId = e.instance.instanceId;
44
+ instanceDataListeners.get(instanceId)?.dispose();
45
+ setTimeout(() => {
46
+ this._proxy.$shellExecutionEnd(instanceId, e.data.command, convertToExtHostCommandLineConfidence(e.data), e.data.isTrusted, e.data.exitCode);
47
+ });
33
48
  }));
34
49
  const cwdChangeEvent = this._store.add(this._terminalService.createOnInstanceCapabilityEvent(0 , e => e.onDidChangeCwd));
35
- this._store.add(cwdChangeEvent.event(e => this._proxy.$cwdChange(e.instance.instanceId, e.data)));
50
+ this._store.add(cwdChangeEvent.event(e => {
51
+ this._proxy.$cwdChange(e.instance.instanceId, this._convertCwdToUri(e.data));
52
+ }));
36
53
  this._store.add(this._terminalService.onDidDisposeInstance(e => this._proxy.$closeTerminal(e.instanceId)));
37
- if (!workbenchEnvironmentService.remoteAuthority) {
38
- this._store.add(this._terminalService.onAnyInstanceData(e => this._proxy.$shellExecutionData(e.instance.instanceId, e.data)));
39
- }
40
54
  }
41
55
  $executeCommand(terminalId, commandLine) {
42
56
  this._terminalService.getInstanceFromId(terminalId)?.runCommand(commandLine, true);
43
57
  }
58
+ _convertCwdToUri(cwd) {
59
+ return cwd ? URI.file(cwd) : undefined;
60
+ }
44
61
  };
45
62
  MainThreadTerminalShellIntegration = __decorate([
46
63
  extHostNamedCustomer(MainContext.MainThreadTerminalShellIntegration),
47
64
  ( __param(1, ITerminalService)),
48
65
  ( __param(2, IWorkbenchEnvironmentService))
49
66
  ], MainThreadTerminalShellIntegration);
67
+ function convertToExtHostCommandLineConfidence(command) {
68
+ switch (command.commandLineConfidence) {
69
+ case 'high':
70
+ return TerminalShellExecutionCommandLineConfidence.High;
71
+ case 'medium':
72
+ return TerminalShellExecutionCommandLineConfidence.Medium;
73
+ case 'low':
74
+ default:
75
+ return TerminalShellExecutionCommandLineConfidence.Low;
76
+ }
77
+ }
50
78
 
51
79
  export { MainThreadTerminalShellIntegration };