@codingame/monaco-vscode-extensions-service-override 4.0.0 → 4.1.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 (109) hide show
  1. package/extensions.js +6 -6
  2. package/package.json +9 -9
  3. package/_virtual/semver.js +0 -3
  4. package/external/vscode-semver/semver.js +0 -985
  5. package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +0 -8
  6. package/vscode/src/vs/base/common/console.js +0 -62
  7. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +0 -497
  8. package/vscode/src/vs/platform/extensionResourceLoader/browser/extensionResourceLoaderService.js +0 -44
  9. package/vscode/src/vs/platform/lifecycle/common/lifecycle.js +0 -27
  10. package/vscode/src/vs/platform/remote/common/managedSocket.js +0 -98
  11. package/vscode/src/vs/workbench/api/browser/extensionHost.contribution.js +0 -104
  12. package/vscode/src/vs/workbench/api/browser/mainThreadAiEmbeddingVector.js +0 -31
  13. package/vscode/src/vs/workbench/api/browser/mainThreadAiRelatedInformation.js +0 -35
  14. package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +0 -254
  15. package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +0 -68
  16. package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +0 -103
  17. package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +0 -70
  18. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +0 -207
  19. package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +0 -41
  20. package/vscode/src/vs/workbench/api/browser/mainThreadClipboard.js +0 -24
  21. package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js +0 -108
  22. package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +0 -98
  23. package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +0 -560
  24. package/vscode/src/vs/workbench/api/browser/mainThreadConfiguration.js +0 -80
  25. package/vscode/src/vs/workbench/api/browser/mainThreadConsole.js +0 -35
  26. package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +0 -579
  27. package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +0 -435
  28. package/vscode/src/vs/workbench/api/browser/mainThreadDecorations.js +0 -102
  29. package/vscode/src/vs/workbench/api/browser/mainThreadDiagnostics.js +0 -69
  30. package/vscode/src/vs/workbench/api/browser/mainThreadDialogs.js +0 -68
  31. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentContentProviders.js +0 -79
  32. package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +0 -253
  33. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +0 -370
  34. package/vscode/src/vs/workbench/api/browser/mainThreadDownloadService.js +0 -22
  35. package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +0 -41
  36. package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +0 -414
  37. package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +0 -501
  38. package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +0 -227
  39. package/vscode/src/vs/workbench/api/browser/mainThreadErrors.js +0 -24
  40. package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +0 -317
  41. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +0 -208
  42. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +0 -369
  43. package/vscode/src/vs/workbench/api/browser/mainThreadInlineChat.js +0 -72
  44. package/vscode/src/vs/workbench/api/browser/mainThreadInteractive.js +0 -28
  45. package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +0 -50
  46. package/vscode/src/vs/workbench/api/browser/mainThreadLabelService.js +0 -27
  47. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +0 -1016
  48. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +0 -185
  49. package/vscode/src/vs/workbench/api/browser/mainThreadLanguages.js +0 -78
  50. package/vscode/src/vs/workbench/api/browser/mainThreadLocalization.js +0 -35
  51. package/vscode/src/vs/workbench/api/browser/mainThreadLogService.js +0 -78
  52. package/vscode/src/vs/workbench/api/browser/mainThreadManagedSockets.js +0 -93
  53. package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +0 -137
  54. package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +0 -194
  55. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +0 -123
  56. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +0 -188
  57. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDto.js +0 -129
  58. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +0 -131
  59. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +0 -374
  60. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +0 -25
  61. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +0 -48
  62. package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +0 -76
  63. package/vscode/src/vs/workbench/api/browser/mainThreadProfileContentHandlers.js +0 -38
  64. package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +0 -68
  65. package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +0 -42
  66. package/vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.js +0 -185
  67. package/vscode/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.js +0 -30
  68. package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +0 -493
  69. package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +0 -49
  70. package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +0 -168
  71. package/vscode/src/vs/workbench/api/browser/mainThreadSecretState.js +0 -70
  72. package/vscode/src/vs/workbench/api/browser/mainThreadShare.js +0 -50
  73. package/vscode/src/vs/workbench/api/browser/mainThreadSpeech.js +0 -99
  74. package/vscode/src/vs/workbench/api/browser/mainThreadStatusBar.js +0 -53
  75. package/vscode/src/vs/workbench/api/browser/mainThreadStorage.js +0 -72
  76. package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +0 -731
  77. package/vscode/src/vs/workbench/api/browser/mainThreadTelemetry.js +0 -53
  78. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +0 -409
  79. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalShellIntegration.js +0 -51
  80. package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +0 -219
  81. package/vscode/src/vs/workbench/api/browser/mainThreadTheming.js +0 -24
  82. package/vscode/src/vs/workbench/api/browser/mainThreadTimeline.js +0 -55
  83. package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +0 -312
  84. package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +0 -223
  85. package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +0 -110
  86. package/vscode/src/vs/workbench/api/browser/mainThreadUrls.js +0 -61
  87. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewManager.js +0 -29
  88. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.js +0 -283
  89. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewViews.js +0 -100
  90. package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +0 -135
  91. package/vscode/src/vs/workbench/api/browser/mainThreadWindow.js +0 -57
  92. package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +0 -268
  93. package/vscode/src/vs/workbench/api/common/shared/dataTransferCache.js +0 -35
  94. package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +0 -76
  95. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/contributedOpeners.js +0 -83
  96. package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +0 -285
  97. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +0 -276
  98. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.js +0 -52
  99. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +0 -1149
  100. package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +0 -41
  101. package/vscode/src/vs/workbench/services/extensions/common/extensionDevOptions.js +0 -25
  102. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +0 -512
  103. package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +0 -274
  104. package/vscode/src/vs/workbench/services/extensions/common/extensionStorageMigration.js +0 -58
  105. package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +0 -80
  106. package/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.js +0 -64
  107. package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.js +0 -161
  108. package/vscode/src/vs/workbench/services/extensions/common/remoteConsoleUtil.js +0 -49
  109. package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +0 -222
@@ -1,731 +0,0 @@
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 };