@codingame/monaco-vscode-extensions-service-override 4.1.0 → 4.1.2

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 (109) hide show
  1. package/_virtual/semver.js +3 -0
  2. package/extensions.js +6 -6
  3. package/external/vscode-semver/semver.js +985 -0
  4. package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +8 -0
  5. package/package.json +9 -9
  6. package/vscode/src/vs/base/common/console.js +62 -0
  7. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +497 -0
  8. package/vscode/src/vs/platform/extensionResourceLoader/browser/extensionResourceLoaderService.js +44 -0
  9. package/vscode/src/vs/platform/lifecycle/common/lifecycle.js +27 -0
  10. package/vscode/src/vs/platform/remote/common/managedSocket.js +98 -0
  11. package/vscode/src/vs/workbench/api/browser/extensionHost.contribution.js +104 -0
  12. package/vscode/src/vs/workbench/api/browser/mainThreadAiEmbeddingVector.js +31 -0
  13. package/vscode/src/vs/workbench/api/browser/mainThreadAiRelatedInformation.js +35 -0
  14. package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +254 -0
  15. package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +68 -0
  16. package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +103 -0
  17. package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +70 -0
  18. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +207 -0
  19. package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +41 -0
  20. package/vscode/src/vs/workbench/api/browser/mainThreadClipboard.js +24 -0
  21. package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js +108 -0
  22. package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +98 -0
  23. package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +560 -0
  24. package/vscode/src/vs/workbench/api/browser/mainThreadConfiguration.js +80 -0
  25. package/vscode/src/vs/workbench/api/browser/mainThreadConsole.js +35 -0
  26. package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +579 -0
  27. package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +435 -0
  28. package/vscode/src/vs/workbench/api/browser/mainThreadDecorations.js +102 -0
  29. package/vscode/src/vs/workbench/api/browser/mainThreadDiagnostics.js +69 -0
  30. package/vscode/src/vs/workbench/api/browser/mainThreadDialogs.js +68 -0
  31. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentContentProviders.js +79 -0
  32. package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +253 -0
  33. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +370 -0
  34. package/vscode/src/vs/workbench/api/browser/mainThreadDownloadService.js +22 -0
  35. package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +41 -0
  36. package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +414 -0
  37. package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +501 -0
  38. package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +227 -0
  39. package/vscode/src/vs/workbench/api/browser/mainThreadErrors.js +24 -0
  40. package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +317 -0
  41. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +208 -0
  42. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +369 -0
  43. package/vscode/src/vs/workbench/api/browser/mainThreadInlineChat.js +72 -0
  44. package/vscode/src/vs/workbench/api/browser/mainThreadInteractive.js +28 -0
  45. package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +50 -0
  46. package/vscode/src/vs/workbench/api/browser/mainThreadLabelService.js +27 -0
  47. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +1016 -0
  48. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +185 -0
  49. package/vscode/src/vs/workbench/api/browser/mainThreadLanguages.js +78 -0
  50. package/vscode/src/vs/workbench/api/browser/mainThreadLocalization.js +35 -0
  51. package/vscode/src/vs/workbench/api/browser/mainThreadLogService.js +78 -0
  52. package/vscode/src/vs/workbench/api/browser/mainThreadManagedSockets.js +93 -0
  53. package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +137 -0
  54. package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +194 -0
  55. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +123 -0
  56. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +188 -0
  57. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDto.js +129 -0
  58. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +131 -0
  59. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +374 -0
  60. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +25 -0
  61. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +48 -0
  62. package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +76 -0
  63. package/vscode/src/vs/workbench/api/browser/mainThreadProfileContentHandlers.js +38 -0
  64. package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +68 -0
  65. package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +42 -0
  66. package/vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.js +185 -0
  67. package/vscode/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.js +30 -0
  68. package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +493 -0
  69. package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +49 -0
  70. package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +168 -0
  71. package/vscode/src/vs/workbench/api/browser/mainThreadSecretState.js +70 -0
  72. package/vscode/src/vs/workbench/api/browser/mainThreadShare.js +50 -0
  73. package/vscode/src/vs/workbench/api/browser/mainThreadSpeech.js +99 -0
  74. package/vscode/src/vs/workbench/api/browser/mainThreadStatusBar.js +53 -0
  75. package/vscode/src/vs/workbench/api/browser/mainThreadStorage.js +72 -0
  76. package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +731 -0
  77. package/vscode/src/vs/workbench/api/browser/mainThreadTelemetry.js +53 -0
  78. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +409 -0
  79. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalShellIntegration.js +51 -0
  80. package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +219 -0
  81. package/vscode/src/vs/workbench/api/browser/mainThreadTheming.js +24 -0
  82. package/vscode/src/vs/workbench/api/browser/mainThreadTimeline.js +55 -0
  83. package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +312 -0
  84. package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +223 -0
  85. package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +110 -0
  86. package/vscode/src/vs/workbench/api/browser/mainThreadUrls.js +61 -0
  87. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewManager.js +29 -0
  88. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.js +283 -0
  89. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewViews.js +100 -0
  90. package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +135 -0
  91. package/vscode/src/vs/workbench/api/browser/mainThreadWindow.js +57 -0
  92. package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +268 -0
  93. package/vscode/src/vs/workbench/api/common/shared/dataTransferCache.js +35 -0
  94. package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +76 -0
  95. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/contributedOpeners.js +83 -0
  96. package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +285 -0
  97. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +276 -0
  98. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.js +52 -0
  99. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +1149 -0
  100. package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +41 -0
  101. package/vscode/src/vs/workbench/services/extensions/common/extensionDevOptions.js +25 -0
  102. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +512 -0
  103. package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +274 -0
  104. package/vscode/src/vs/workbench/services/extensions/common/extensionStorageMigration.js +58 -0
  105. package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +80 -0
  106. package/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.js +64 -0
  107. package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.js +161 -0
  108. package/vscode/src/vs/workbench/services/extensions/common/remoteConsoleUtil.js +49 -0
  109. package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +222 -0
@@ -0,0 +1,731 @@
1
+ import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
+ import { URI } from 'vscode/vscode/vs/base/common/uri';
4
+ import { generateUuid } from 'vscode/vscode/vs/base/common/uuid';
5
+ import { isString } from 'vscode/vscode/vs/base/common/types';
6
+ import { platform } from 'vscode/vscode/vs/base/common/platform';
7
+ import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
8
+ import { TaskDefinition, PresentationOptions, RunOptions, CommandOptions, RuntimeType, TaskSourceKind, CustomTask, ContributedTask, ConfiguringTask } from 'vscode/vscode/vs/workbench/contrib/tasks/common/tasks';
9
+ import { ITaskService } from 'vscode/vscode/vs/workbench/contrib/tasks/common/taskService';
10
+ import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
11
+ import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
12
+ import { IConfigurationResolverService } from 'vscode/vscode/vs/workbench/services/configurationResolver/common/configurationResolver';
13
+ import { ErrorNoTelemetry } from 'vscode/vscode/vs/base/common/errors';
14
+
15
+ var TaskExecutionDTO;
16
+ ( (function(TaskExecutionDTO) {
17
+ function from(value) {
18
+ return {
19
+ id: value.id,
20
+ task: TaskDTO.from(value.task)
21
+ };
22
+ }
23
+ TaskExecutionDTO.from = from;
24
+ })(TaskExecutionDTO || (TaskExecutionDTO = {})));
25
+ var TaskProcessStartedDTO;
26
+ ( (function(TaskProcessStartedDTO) {
27
+ function from(value, processId) {
28
+ return {
29
+ id: value.id,
30
+ processId
31
+ };
32
+ }
33
+ TaskProcessStartedDTO.from = from;
34
+ })(TaskProcessStartedDTO || (TaskProcessStartedDTO = {})));
35
+ var TaskProcessEndedDTO;
36
+ ( (function(TaskProcessEndedDTO) {
37
+ function from(value, exitCode) {
38
+ return {
39
+ id: value.id,
40
+ exitCode
41
+ };
42
+ }
43
+ TaskProcessEndedDTO.from = from;
44
+ })(TaskProcessEndedDTO || (TaskProcessEndedDTO = {})));
45
+ var TaskDefinitionDTO;
46
+ ( (function(TaskDefinitionDTO) {
47
+ function from(value) {
48
+ const result = Object.assign(Object.create(null), value);
49
+ delete result._key;
50
+ return result;
51
+ }
52
+ TaskDefinitionDTO.from = from;
53
+ function to(value, executeOnly) {
54
+ let result = TaskDefinition.createTaskIdentifier(value, console);
55
+ if (result === undefined && executeOnly) {
56
+ result = {
57
+ _key: generateUuid(),
58
+ type: '$executeOnly'
59
+ };
60
+ }
61
+ return result;
62
+ }
63
+ TaskDefinitionDTO.to = to;
64
+ })(TaskDefinitionDTO || (TaskDefinitionDTO = {})));
65
+ var TaskPresentationOptionsDTO;
66
+ ( (function(TaskPresentationOptionsDTO) {
67
+ function from(value) {
68
+ if (value === undefined || value === null) {
69
+ return undefined;
70
+ }
71
+ return Object.assign(Object.create(null), value);
72
+ }
73
+ TaskPresentationOptionsDTO.from = from;
74
+ function to(value) {
75
+ if (value === undefined || value === null) {
76
+ return PresentationOptions.defaults;
77
+ }
78
+ return Object.assign(Object.create(null), PresentationOptions.defaults, value);
79
+ }
80
+ TaskPresentationOptionsDTO.to = to;
81
+ })(TaskPresentationOptionsDTO || (TaskPresentationOptionsDTO = {})));
82
+ var RunOptionsDTO;
83
+ ( (function(RunOptionsDTO) {
84
+ function from(value) {
85
+ if (value === undefined || value === null) {
86
+ return undefined;
87
+ }
88
+ return Object.assign(Object.create(null), value);
89
+ }
90
+ RunOptionsDTO.from = from;
91
+ function to(value) {
92
+ if (value === undefined || value === null) {
93
+ return RunOptions.defaults;
94
+ }
95
+ return Object.assign(Object.create(null), RunOptions.defaults, value);
96
+ }
97
+ RunOptionsDTO.to = to;
98
+ })(RunOptionsDTO || (RunOptionsDTO = {})));
99
+ var ProcessExecutionOptionsDTO;
100
+ ( (function(ProcessExecutionOptionsDTO) {
101
+ function from(value) {
102
+ if (value === undefined || value === null) {
103
+ return undefined;
104
+ }
105
+ return {
106
+ cwd: value.cwd,
107
+ env: value.env
108
+ };
109
+ }
110
+ ProcessExecutionOptionsDTO.from = from;
111
+ function to(value) {
112
+ if (value === undefined || value === null) {
113
+ return CommandOptions.defaults;
114
+ }
115
+ return {
116
+ cwd: value.cwd || CommandOptions.defaults.cwd,
117
+ env: value.env
118
+ };
119
+ }
120
+ ProcessExecutionOptionsDTO.to = to;
121
+ })(ProcessExecutionOptionsDTO || (ProcessExecutionOptionsDTO = {})));
122
+ var ProcessExecutionDTO;
123
+ ( (function(ProcessExecutionDTO) {
124
+ function is(value) {
125
+ const candidate = value;
126
+ return candidate && !!candidate.process;
127
+ }
128
+ ProcessExecutionDTO.is = is;
129
+ function from(value) {
130
+ const process = isString(value.name) ? value.name : value.name.value;
131
+ const args = value.args ? ( value.args.map(value => isString(value) ? value : value.value)) : [];
132
+ const result = {
133
+ process: process,
134
+ args: args
135
+ };
136
+ if (value.options) {
137
+ result.options = ProcessExecutionOptionsDTO.from(value.options);
138
+ }
139
+ return result;
140
+ }
141
+ ProcessExecutionDTO.from = from;
142
+ function to(value) {
143
+ const result = {
144
+ runtime: RuntimeType.Process,
145
+ name: value.process,
146
+ args: value.args,
147
+ presentation: undefined
148
+ };
149
+ result.options = ProcessExecutionOptionsDTO.to(value.options);
150
+ return result;
151
+ }
152
+ ProcessExecutionDTO.to = to;
153
+ })(ProcessExecutionDTO || (ProcessExecutionDTO = {})));
154
+ var ShellExecutionOptionsDTO;
155
+ ( (function(ShellExecutionOptionsDTO) {
156
+ function from(value) {
157
+ if (value === undefined || value === null) {
158
+ return undefined;
159
+ }
160
+ const result = {
161
+ cwd: value.cwd || CommandOptions.defaults.cwd,
162
+ env: value.env
163
+ };
164
+ if (value.shell) {
165
+ result.executable = value.shell.executable;
166
+ result.shellArgs = value.shell.args;
167
+ result.shellQuoting = value.shell.quoting;
168
+ }
169
+ return result;
170
+ }
171
+ ShellExecutionOptionsDTO.from = from;
172
+ function to(value) {
173
+ if (value === undefined || value === null) {
174
+ return undefined;
175
+ }
176
+ const result = {
177
+ cwd: value.cwd,
178
+ env: value.env
179
+ };
180
+ if (value.executable) {
181
+ result.shell = {
182
+ executable: value.executable
183
+ };
184
+ if (value.shellArgs) {
185
+ result.shell.args = value.shellArgs;
186
+ }
187
+ if (value.shellQuoting) {
188
+ result.shell.quoting = value.shellQuoting;
189
+ }
190
+ }
191
+ return result;
192
+ }
193
+ ShellExecutionOptionsDTO.to = to;
194
+ })(ShellExecutionOptionsDTO || (ShellExecutionOptionsDTO = {})));
195
+ var ShellExecutionDTO;
196
+ ( (function(ShellExecutionDTO) {
197
+ function is(value) {
198
+ const candidate = value;
199
+ return candidate && (!!candidate.commandLine || !!candidate.command);
200
+ }
201
+ ShellExecutionDTO.is = is;
202
+ function from(value) {
203
+ const result = {};
204
+ if (value.name && isString(value.name) && (value.args === undefined || value.args === null || value.args.length === 0)) {
205
+ result.commandLine = value.name;
206
+ }
207
+ else {
208
+ result.command = value.name;
209
+ result.args = value.args;
210
+ }
211
+ if (value.options) {
212
+ result.options = ShellExecutionOptionsDTO.from(value.options);
213
+ }
214
+ return result;
215
+ }
216
+ ShellExecutionDTO.from = from;
217
+ function to(value) {
218
+ const result = {
219
+ runtime: RuntimeType.Shell,
220
+ name: value.commandLine ? value.commandLine : value.command,
221
+ args: value.args,
222
+ presentation: undefined
223
+ };
224
+ if (value.options) {
225
+ result.options = ShellExecutionOptionsDTO.to(value.options);
226
+ }
227
+ return result;
228
+ }
229
+ ShellExecutionDTO.to = to;
230
+ })(ShellExecutionDTO || (ShellExecutionDTO = {})));
231
+ var CustomExecutionDTO;
232
+ ( (function(CustomExecutionDTO) {
233
+ function is(value) {
234
+ const candidate = value;
235
+ return candidate && candidate.customExecution === 'customExecution';
236
+ }
237
+ CustomExecutionDTO.is = is;
238
+ function from(value) {
239
+ return {
240
+ customExecution: 'customExecution'
241
+ };
242
+ }
243
+ CustomExecutionDTO.from = from;
244
+ function to(value) {
245
+ return {
246
+ runtime: RuntimeType.CustomExecution,
247
+ presentation: undefined
248
+ };
249
+ }
250
+ CustomExecutionDTO.to = to;
251
+ })(CustomExecutionDTO || (CustomExecutionDTO = {})));
252
+ var TaskSourceDTO;
253
+ ( (function(TaskSourceDTO) {
254
+ function from(value) {
255
+ const result = {
256
+ label: value.label
257
+ };
258
+ if (value.kind === TaskSourceKind.Extension) {
259
+ result.extensionId = value.extension;
260
+ if (value.workspaceFolder) {
261
+ result.scope = value.workspaceFolder.uri;
262
+ }
263
+ else {
264
+ result.scope = value.scope;
265
+ }
266
+ }
267
+ else if (value.kind === TaskSourceKind.Workspace) {
268
+ result.extensionId = '$core';
269
+ result.scope = value.config.workspaceFolder ? value.config.workspaceFolder.uri : 1 ;
270
+ }
271
+ return result;
272
+ }
273
+ TaskSourceDTO.from = from;
274
+ function to(value, workspace) {
275
+ let scope;
276
+ let workspaceFolder;
277
+ if ((value.scope === undefined) || ((typeof value.scope === 'number') && ((value.scope !== 1) ))) {
278
+ if (workspace.getWorkspace().folders.length === 0) {
279
+ scope = 1 ;
280
+ workspaceFolder = undefined;
281
+ }
282
+ else {
283
+ scope = 3 ;
284
+ workspaceFolder = workspace.getWorkspace().folders[0];
285
+ }
286
+ }
287
+ else if (typeof value.scope === 'number') {
288
+ scope = value.scope;
289
+ }
290
+ else {
291
+ scope = 3 ;
292
+ workspaceFolder = workspace.getWorkspaceFolder(URI.revive(value.scope)) ?? undefined;
293
+ }
294
+ const result = {
295
+ kind: TaskSourceKind.Extension,
296
+ label: value.label,
297
+ extension: value.extensionId,
298
+ scope,
299
+ workspaceFolder
300
+ };
301
+ return result;
302
+ }
303
+ TaskSourceDTO.to = to;
304
+ })(TaskSourceDTO || (TaskSourceDTO = {})));
305
+ var TaskHandleDTO;
306
+ ( (function(TaskHandleDTO) {
307
+ function is(value) {
308
+ const candidate = value;
309
+ return candidate && isString(candidate.id) && !!candidate.workspaceFolder;
310
+ }
311
+ TaskHandleDTO.is = is;
312
+ })(TaskHandleDTO || (TaskHandleDTO = {})));
313
+ var TaskDTO;
314
+ ( (function(TaskDTO) {
315
+ function from(task) {
316
+ if (task === undefined || task === null || (!CustomTask.is(task) && !ContributedTask.is(task) && !ConfiguringTask.is(task))) {
317
+ return undefined;
318
+ }
319
+ const result = {
320
+ _id: task._id,
321
+ name: task.configurationProperties.name,
322
+ definition: TaskDefinitionDTO.from(task.getDefinition(true)),
323
+ source: TaskSourceDTO.from(task._source),
324
+ execution: undefined,
325
+ presentationOptions: !ConfiguringTask.is(task) && task.command ? TaskPresentationOptionsDTO.from(task.command.presentation) : undefined,
326
+ isBackground: task.configurationProperties.isBackground,
327
+ problemMatchers: [],
328
+ hasDefinedMatchers: ContributedTask.is(task) ? task.hasDefinedMatchers : false,
329
+ runOptions: RunOptionsDTO.from(task.runOptions),
330
+ };
331
+ result.group = TaskGroupDTO.from(task.configurationProperties.group);
332
+ if (task.configurationProperties.detail) {
333
+ result.detail = task.configurationProperties.detail;
334
+ }
335
+ if (!ConfiguringTask.is(task) && task.command) {
336
+ switch (task.command.runtime) {
337
+ case RuntimeType.Process:
338
+ result.execution = ProcessExecutionDTO.from(task.command);
339
+ break;
340
+ case RuntimeType.Shell:
341
+ result.execution = ShellExecutionDTO.from(task.command);
342
+ break;
343
+ case RuntimeType.CustomExecution:
344
+ result.execution = CustomExecutionDTO.from(task.command);
345
+ break;
346
+ }
347
+ }
348
+ if (task.configurationProperties.problemMatchers) {
349
+ for (const matcher of task.configurationProperties.problemMatchers) {
350
+ if (isString(matcher)) {
351
+ result.problemMatchers.push(matcher);
352
+ }
353
+ }
354
+ }
355
+ return result;
356
+ }
357
+ TaskDTO.from = from;
358
+ function to(task, workspace, executeOnly, icon, hide) {
359
+ if (!task || (typeof task.name !== 'string')) {
360
+ return undefined;
361
+ }
362
+ let command;
363
+ if (task.execution) {
364
+ if (ShellExecutionDTO.is(task.execution)) {
365
+ command = ShellExecutionDTO.to(task.execution);
366
+ }
367
+ else if (ProcessExecutionDTO.is(task.execution)) {
368
+ command = ProcessExecutionDTO.to(task.execution);
369
+ }
370
+ else if (CustomExecutionDTO.is(task.execution)) {
371
+ command = CustomExecutionDTO.to(task.execution);
372
+ }
373
+ }
374
+ if (!command) {
375
+ return undefined;
376
+ }
377
+ command.presentation = TaskPresentationOptionsDTO.to(task.presentationOptions);
378
+ 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
+ ));
386
+ const definition = TaskDefinitionDTO.to(task.definition, executeOnly);
387
+ 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
+ }));
399
+ return result;
400
+ }
401
+ TaskDTO.to = to;
402
+ })(TaskDTO || (TaskDTO = {})));
403
+ var TaskGroupDTO;
404
+ ( (function(TaskGroupDTO) {
405
+ function from(value) {
406
+ if (value === undefined) {
407
+ return undefined;
408
+ }
409
+ return {
410
+ _id: (typeof value === 'string') ? value : value._id,
411
+ isDefault: (typeof value === 'string') ? false : ((typeof value.isDefault === 'string') ? false : value.isDefault)
412
+ };
413
+ }
414
+ TaskGroupDTO.from = from;
415
+ })(TaskGroupDTO || (TaskGroupDTO = {})));
416
+ var TaskFilterDTO;
417
+ ( (function(TaskFilterDTO) {
418
+ function from(value) {
419
+ return value;
420
+ }
421
+ TaskFilterDTO.from = from;
422
+ function to(value) {
423
+ return value;
424
+ }
425
+ TaskFilterDTO.to = to;
426
+ })(TaskFilterDTO || (TaskFilterDTO = {})));
427
+ let MainThreadTask = class MainThreadTask {
428
+ constructor(extHostContext, _taskService, _workspaceContextServer, _configurationResolverService) {
429
+ this._taskService = _taskService;
430
+ this._workspaceContextServer = _workspaceContextServer;
431
+ this._configurationResolverService = _configurationResolverService;
432
+ this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostTask));
433
+ this._providers = ( new Map());
434
+ this._taskService.onDidStateChange(async (event) => {
435
+ if (event.kind === "changed" ) {
436
+ return;
437
+ }
438
+ const task = event.__task;
439
+ if (event.kind === "start" ) {
440
+ const execution = TaskExecutionDTO.from(task.getTaskExecution());
441
+ let resolvedDefinition = execution.task.definition;
442
+ if (execution.task?.execution && CustomExecutionDTO.is(execution.task.execution) && event.resolvedVariables) {
443
+ const dictionary = {};
444
+ for (const [key, value] of event.resolvedVariables.entries()) {
445
+ dictionary[key] = value;
446
+ }
447
+ resolvedDefinition = await this._configurationResolverService.resolveAnyAsync(task.getWorkspaceFolder(), execution.task.definition, dictionary);
448
+ }
449
+ this._proxy.$onDidStartTask(execution, event.terminalId, resolvedDefinition);
450
+ }
451
+ else if (event.kind === "processStarted" ) {
452
+ this._proxy.$onDidStartTaskProcess(TaskProcessStartedDTO.from(task.getTaskExecution(), event.processId));
453
+ }
454
+ else if (event.kind === "processEnded" ) {
455
+ this._proxy.$onDidEndTaskProcess(TaskProcessEndedDTO.from(task.getTaskExecution(), event.exitCode));
456
+ }
457
+ else if (event.kind === "end" ) {
458
+ this._proxy.$OnDidEndTask(TaskExecutionDTO.from(task.getTaskExecution()));
459
+ }
460
+ });
461
+ }
462
+ dispose() {
463
+ for (const value of ( this._providers.values())) {
464
+ value.disposable.dispose();
465
+ }
466
+ this._providers.clear();
467
+ }
468
+ $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
+ }));
478
+ }
479
+ $registerTaskProvider(handle, type) {
480
+ const provider = {
481
+ provideTasks: (validTypes) => {
482
+ return Promise.resolve(this._proxy.$provideTasks(handle, validTypes)).then((value) => {
483
+ const tasks = [];
484
+ for (const dto of value.tasks) {
485
+ const task = TaskDTO.to(dto, this._workspaceContextServer, true);
486
+ if (task) {
487
+ tasks.push(task);
488
+ }
489
+ else {
490
+ console.error(`Task System: can not convert task: ${JSON.stringify(dto.definition, undefined, 0)}. Task will be dropped`);
491
+ }
492
+ }
493
+ return {
494
+ tasks,
495
+ extension: value.extension
496
+ };
497
+ });
498
+ },
499
+ resolveTask: (task) => {
500
+ const dto = TaskDTO.from(task);
501
+ if (dto) {
502
+ dto.name = ((dto.name === undefined) ? '' : dto.name);
503
+ return Promise.resolve(this._proxy.$resolveTask(handle, dto)).then(resolvedTask => {
504
+ if (resolvedTask) {
505
+ return TaskDTO.to(resolvedTask, this._workspaceContextServer, true, task.configurationProperties.icon, task.configurationProperties.hide);
506
+ }
507
+ return undefined;
508
+ });
509
+ }
510
+ return Promise.resolve(undefined);
511
+ }
512
+ };
513
+ const disposable = this._taskService.registerTaskProvider(provider, type);
514
+ this._providers.set(handle, { disposable, provider });
515
+ return Promise.resolve(undefined);
516
+ }
517
+ $unregisterTaskProvider(handle) {
518
+ const provider = this._providers.get(handle);
519
+ if (provider) {
520
+ provider.disposable.dispose();
521
+ this._providers.delete(handle);
522
+ }
523
+ return Promise.resolve(undefined);
524
+ }
525
+ $fetchTasks(filter) {
526
+ return this._taskService.tasks(TaskFilterDTO.to(filter)).then((tasks) => {
527
+ const result = [];
528
+ for (const task of tasks) {
529
+ const item = TaskDTO.from(task);
530
+ if (item) {
531
+ result.push(item);
532
+ }
533
+ }
534
+ return result;
535
+ });
536
+ }
537
+ getWorkspace(value) {
538
+ let workspace;
539
+ if (typeof value === 'string') {
540
+ workspace = value;
541
+ }
542
+ else {
543
+ const workspaceObject = this._workspaceContextServer.getWorkspace();
544
+ const uri = URI.revive(value);
545
+ if (workspaceObject.configuration?.toString() === ( uri.toString())) {
546
+ workspace = workspaceObject;
547
+ }
548
+ else {
549
+ workspace = this._workspaceContextServer.getWorkspaceFolder(uri);
550
+ }
551
+ }
552
+ return workspace;
553
+ }
554
+ async $getTaskExecution(value) {
555
+ if (TaskHandleDTO.is(value)) {
556
+ const workspace = this.getWorkspace(value.workspaceFolder);
557
+ if (workspace) {
558
+ const task = await this._taskService.getTask(workspace, value.id, true);
559
+ if (task) {
560
+ return {
561
+ id: task._id,
562
+ task: TaskDTO.from(task)
563
+ };
564
+ }
565
+ throw new Error('Task not found');
566
+ }
567
+ else {
568
+ throw new Error('No workspace folder');
569
+ }
570
+ }
571
+ else {
572
+ const task = TaskDTO.to(value, this._workspaceContextServer, true);
573
+ return {
574
+ id: task._id,
575
+ task: TaskDTO.from(task)
576
+ };
577
+ }
578
+ }
579
+ $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
+ });
604
+ }
605
+ else {
606
+ reject(( new Error('No workspace folder')));
607
+ }
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
+ }));
620
+ }
621
+ $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;
632
+ }
633
+ }
634
+ reject(( new Error('Task to mark as complete not found')));
635
+ });
636
+ }));
637
+ }
638
+ $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;
649
+ }
650
+ }
651
+ reject(( new ErrorNoTelemetry('Task to terminate not found')));
652
+ });
653
+ }));
654
+ }
655
+ $registerTaskSystem(key, info) {
656
+ let platform$1;
657
+ switch (info.platform) {
658
+ case 'Web':
659
+ platform$1 = 0 ;
660
+ break;
661
+ case 'win32':
662
+ platform$1 = 3 ;
663
+ break;
664
+ case 'darwin':
665
+ platform$1 = 1 ;
666
+ break;
667
+ case 'linux':
668
+ platform$1 = 2 ;
669
+ break;
670
+ default:
671
+ platform$1 = platform;
672
+ }
673
+ this._taskService.registerTaskSystem(key, {
674
+ platform: platform$1,
675
+ uriProvider: (path) => {
676
+ return ( URI.from({ scheme: info.scheme, authority: info.authority, path }));
677
+ },
678
+ context: this._extHostContext,
679
+ resolveVariables: (workspaceFolder, toResolve, target) => {
680
+ const vars = [];
681
+ toResolve.variables.forEach(item => vars.push(item));
682
+ 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);
699
+ }
700
+ }
701
+ else {
702
+ result.variables.set(variableName, partiallyResolvedVars[i]);
703
+ }
704
+ }
705
+ if (isString(values.process)) {
706
+ result.process = values.process;
707
+ }
708
+ resolve(result);
709
+ }, reason => {
710
+ reject(reason);
711
+ });
712
+ }));
713
+ });
714
+ },
715
+ findExecutable: (command, cwd, paths) => {
716
+ return this._proxy.$findExecutable(command, cwd, paths);
717
+ }
718
+ });
719
+ }
720
+ async $registerSupportedExecutions(custom, shell, process) {
721
+ return this._taskService.registerSupportedExecutions(custom, shell, process);
722
+ }
723
+ };
724
+ MainThreadTask = __decorate([
725
+ extHostNamedCustomer(MainContext.MainThreadTask),
726
+ ( __param(1, ITaskService)),
727
+ ( __param(2, IWorkspaceContextService)),
728
+ ( __param(3, IConfigurationResolverService))
729
+ ], MainThreadTask);
730
+
731
+ export { MainThreadTask };