@codingame/monaco-vscode-extension-gallery-service-override 5.3.0 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/platform/extensionManagement/common/abstractExtensionManagementService.js +79 -70
  3. package/vscode/src/vs/platform/extensionManagement/common/extensionGalleryService.js +49 -20
  4. package/vscode/src/vs/platform/extensionManagement/common/extensionTipsService.js +6 -0
  5. package/vscode/src/vs/platform/extensionManagement/common/unsupportedExtensionsMigration.js +4 -2
  6. package/vscode/src/vs/platform/extensionRecommendations/common/extensionRecommendations.js +20 -4
  7. package/vscode/src/vs/platform/externalServices/common/marketplace.js +2 -1
  8. package/vscode/src/vs/platform/userDataProfile/common/userDataProfileIpc.js +2 -0
  9. package/vscode/src/vs/platform/userDataSync/common/ignoredExtensions.js +3 -2
  10. package/vscode/src/vs/workbench/contrib/extensions/browser/abstractRuntimeExtensionsEditor.js +3 -3
  11. package/vscode/src/vs/workbench/contrib/extensions/browser/configBasedRecommendations.js +2 -1
  12. package/vscode/src/vs/workbench/contrib/extensions/browser/deprecatedExtensionsChecker.js +5 -4
  13. package/vscode/src/vs/workbench/contrib/extensions/browser/exeBasedRecommendations.js +2 -1
  14. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEditor.js +43 -35
  15. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionFeaturesTab.js +2 -1
  16. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationNotificationService.js +27 -24
  17. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationsService.js +4 -2
  18. package/vscode/src/vs/workbench/contrib/extensions/browser/extensions.contribution.js +44 -39
  19. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActivationProgress.js +2 -1
  20. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsCompletionItemsProvider.js +3 -2
  21. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsList.js +4 -4
  22. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.js +2 -1
  23. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewer.js +4 -2
  24. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.js +8 -6
  25. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViews.js +43 -32
  26. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWidgets.js +21 -15
  27. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.js +114 -65
  28. package/vscode/src/vs/workbench/contrib/extensions/browser/fileBasedRecommendations.js +12 -8
  29. package/vscode/src/vs/workbench/contrib/extensions/browser/keymapRecommendations.js +2 -1
  30. package/vscode/src/vs/workbench/contrib/extensions/browser/languageRecommendations.js +3 -2
  31. package/vscode/src/vs/workbench/contrib/extensions/browser/media/extensionEditor.css.js +1 -1
  32. package/vscode/src/vs/workbench/contrib/extensions/browser/remoteRecommendations.js +2 -1
  33. package/vscode/src/vs/workbench/contrib/extensions/browser/webRecommendations.js +3 -2
  34. package/vscode/src/vs/workbench/contrib/extensions/browser/workspaceRecommendations.js +7 -5
  35. package/vscode/src/vs/workbench/contrib/extensions/common/extensionQuery.js +2 -3
  36. package/vscode/src/vs/workbench/contrib/extensions/common/reportExtensionIssueAction.js +1 -1
  37. package/vscode/src/vs/workbench/contrib/extensions/common/runtimeExtensionsInput.js +2 -1
  38. package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.js +42 -37
  39. package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionsProfileScannerService.js +1 -0
  40. package/vscode/src/vs/workbench/services/extensionManagement/browser/webExtensionsScannerService.js +16 -11
  41. package/vscode/src/vs/workbench/services/extensionManagement/common/extensionFeaturesManagemetService.js +5 -3
  42. package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementChannelClient.js +3 -3
  43. package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementServerService.js +3 -1
  44. package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementService.js +29 -22
  45. package/vscode/src/vs/workbench/services/extensionManagement/common/webExtensionManagementService.js +9 -8
  46. package/vscode/src/vs/workbench/services/extensionRecommendations/common/extensionIgnoredRecommendationsService.js +5 -3
  47. package/vscode/src/vs/workbench/services/extensions/browser/extensionUrlHandler.js +12 -9
  48. package/vscode/src/vs/workbench/services/extensions/browser/extensionsScannerService.js +1 -0
  49. package/vscode/src/vs/workbench/services/userDataProfile/common/remoteUserDataProfiles.js +5 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-extension-gallery-service-override",
3
- "version": "5.3.0",
3
+ "version": "6.0.1",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -26,6 +26,6 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "vscode": "npm:@codingame/monaco-vscode-api@5.3.0"
29
+ "vscode": "npm:@codingame/monaco-vscode-api@6.0.1"
30
30
  }
31
31
  }
@@ -9,10 +9,10 @@ import { isWeb } from 'vscode/vscode/vs/base/common/platform';
9
9
  import { isDefined } from 'vscode/vscode/vs/base/common/types';
10
10
  import { URI } from 'vscode/vscode/vs/base/common/uri';
11
11
  import { localizeWithPath } from 'vscode/vscode/vs/nls';
12
- import { isTargetPlatformCompatible, ExtensionManagementError, ExtensionManagementErrorCode, EXTENSION_INSTALL_DEP_PACK_CONTEXT, TargetPlatformToString, ExtensionGalleryError } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
12
+ import { isTargetPlatformCompatible, ExtensionManagementError, ExtensionManagementErrorCode, InstallOperation, EXTENSION_INSTALL_DEP_PACK_CONTEXT, EXTENSION_INSTALL_SOURCE_CONTEXT, StatisticType, TargetPlatformToString, ExtensionGalleryError, ExtensionGalleryErrorCode } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
13
13
  import { IExtensionGalleryService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement.service';
14
14
  import { areSameExtensions, ExtensionKey, getGalleryExtensionId, getGalleryExtensionTelemetryData, getLocalExtensionTelemetryData } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
15
- import { isApplicationScopedExtension } from 'vscode/vscode/vs/platform/extensions/common/extensions';
15
+ import { isApplicationScopedExtension, ExtensionType } from 'vscode/vscode/vs/platform/extensions/common/extensions';
16
16
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
17
17
  import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
18
18
  import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
@@ -92,7 +92,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
92
92
  installableExtensions.push({ ...compatible, options });
93
93
  }
94
94
  catch (error) {
95
- results.push({ identifier: extension.identifier, operation: 2 , source: extension, error });
95
+ results.push({ identifier: extension.identifier, operation: InstallOperation.Install, source: extension, error });
96
96
  }
97
97
  }))));
98
98
  if (installableExtensions.length) {
@@ -114,7 +114,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
114
114
  local = await this.copyExtension(extension, this.userDataProfilesService.defaultProfile.extensionsResource, fromProfileLocation);
115
115
  }
116
116
  for (const profile of this.userDataProfilesService.profiles) {
117
- const existing = (await this.getInstalled(1 , profile.extensionsResource))
117
+ const existing = (await this.getInstalled(ExtensionType.User, profile.extensionsResource))
118
118
  .find(e => areSameExtensions(e.identifier, extension.identifier));
119
119
  if (existing) {
120
120
  this._onDidUpdateExtensionMetadata.fire(existing);
@@ -129,7 +129,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
129
129
  const local = this.uriIdentityService.extUri.isEqual(fromProfileLocation, this.userDataProfilesService.defaultProfile.extensionsResource)
130
130
  ? await this.updateMetadata(extension, { isApplicationScoped: true }, this.userDataProfilesService.defaultProfile.extensionsResource)
131
131
  : await this.copyExtension(extension, fromProfileLocation, this.userDataProfilesService.defaultProfile.extensionsResource, { isApplicationScoped: true });
132
- this._onDidInstallExtensions.fire([{ identifier: local.identifier, operation: 2 , local, profileLocation: this.userDataProfilesService.defaultProfile.extensionsResource, applicationScoped: true }]);
132
+ this._onDidInstallExtensions.fire([{ identifier: local.identifier, operation: InstallOperation.Install, local, profileLocation: this.userDataProfilesService.defaultProfile.extensionsResource, applicationScoped: true }]);
133
133
  return local;
134
134
  }
135
135
  }
@@ -154,7 +154,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
154
154
  const key = `${getGalleryExtensionId(manifest.publisher, manifest.name)}-${( (options.profileLocation.toString()))}`;
155
155
  installingExtensionsMap.set(key, { task: installExtensionTask, root });
156
156
  this._onInstallExtension.fire({ identifier: installExtensionTask.identifier, source: extension, profileLocation: options.profileLocation });
157
- this.logService.info('Installing extension:', installExtensionTask.identifier.id);
157
+ this.logService.info('Installing extension:', installExtensionTask.identifier.id, ( (options.profileLocation.toString())));
158
158
  if (!URI.isUri(extension)) {
159
159
  this.installingExtensions.set(getInstallExtensionTaskKey(extension, options.profileLocation), { task: installExtensionTask, waitingTasks: [] });
160
160
  }
@@ -171,7 +171,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
171
171
  };
172
172
  const existingInstallExtensionTask = !URI.isUri(extension) ? this.installingExtensions.get(getInstallExtensionTaskKey(extension, installExtensionTaskOptions.profileLocation)) : undefined;
173
173
  if (existingInstallExtensionTask) {
174
- this.logService.info('Extension is already requested to install', existingInstallExtensionTask.task.identifier.id);
174
+ this.logService.info('Extension is already requested to install', existingInstallExtensionTask.task.identifier.id, ( (installExtensionTaskOptions.profileLocation.toString())));
175
175
  alreadyRequestedInstallations.push(existingInstallExtensionTask.task.waitUntilTaskIsFinished());
176
176
  }
177
177
  else {
@@ -197,10 +197,10 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
197
197
  if (existingInstallingExtension) {
198
198
  if (this.canWaitForTask(task, existingInstallingExtension.task)) {
199
199
  const identifier = existingInstallingExtension.task.identifier;
200
- this.logService.info('Waiting for already requested installing extension', identifier.id, task.identifier.id);
200
+ this.logService.info('Waiting for already requested installing extension', identifier.id, task.identifier.id, ( (options.profileLocation.toString())));
201
201
  existingInstallingExtension.waitingTasks.push(task);
202
202
  alreadyRequestedInstallations.push(Event.toPromise(Event.filter(this.onDidInstallExtensions, results => ( (results.some(result => areSameExtensions(result.identifier, identifier)))))).then(results => {
203
- this.logService.info('Finished waiting for already requested installing extension', identifier.id, task.identifier.id);
203
+ this.logService.info('Finished waiting for already requested installing extension', identifier.id, task.identifier.id, ( (options.profileLocation.toString())));
204
204
  const result = results.find(result => areSameExtensions(result.identifier, identifier));
205
205
  if (!result?.local) {
206
206
  throw ( (new Error(`Extension ${identifier.id} is not installed`)));
@@ -231,38 +231,44 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
231
231
  }))));
232
232
  await this.joinAllSettled(( ([...installingExtensionsMap.entries()].map(async ([key, { task }]) => {
233
233
  const startTime = ( (new Date())).getTime();
234
+ let local;
234
235
  try {
235
- const local = await task.run();
236
+ local = await task.run();
236
237
  await this.joinAllSettled(( (this.participants.map(
237
238
  participant => participant.postInstall(local, task.source, task.options, CancellationToken.None)
238
- ))));
239
- if (!URI.isUri(task.source)) {
240
- const isUpdate = task.operation === 3 ;
241
- const durationSinceUpdate = isUpdate ? undefined : (( (new Date())).getTime() - task.source.lastUpdated) / 1000;
242
- reportTelemetry(this.telemetryService, isUpdate ? 'extensionGallery:update' : 'extensionGallery:install', {
243
- extensionData: getGalleryExtensionTelemetryData(task.source),
244
- verificationStatus: task.verificationStatus,
245
- duration: ( (new Date())).getTime() - startTime,
246
- durationSinceUpdate
247
- });
248
- if (isWeb && task.operation !== 3 ) {
249
- try {
250
- await this.galleryService.reportStatistic(local.manifest.publisher, local.manifest.name, local.manifest.version, "install" );
251
- }
252
- catch (error) { }
253
- }
254
- }
255
- installExtensionResultsMap.set(key, { local, identifier: task.identifier, operation: task.operation, source: task.source, context: task.options.context, profileLocation: task.profileLocation, applicationScoped: local.isApplicationScoped });
239
+ ))), ExtensionManagementErrorCode.PostInstall);
256
240
  }
257
241
  catch (e) {
258
242
  const error = toExtensionManagementError(e);
259
243
  if (!URI.isUri(task.source)) {
260
- reportTelemetry(this.telemetryService, task.operation === 3 ? 'extensionGallery:update' : 'extensionGallery:install', { extensionData: getGalleryExtensionTelemetryData(task.source), error });
244
+ reportTelemetry(this.telemetryService, task.operation === InstallOperation.Update ? 'extensionGallery:update' : 'extensionGallery:install', {
245
+ extensionData: getGalleryExtensionTelemetryData(task.source),
246
+ error,
247
+ source: task.options.context?.[EXTENSION_INSTALL_SOURCE_CONTEXT]
248
+ });
261
249
  }
262
- installExtensionResultsMap.set(key, { error, identifier: task.identifier, operation: task.operation, source: task.source, context: task.options.context, profileLocation: task.profileLocation, applicationScoped: task.options.isApplicationScoped });
263
- this.logService.error('Error while installing the extension', task.identifier.id, getErrorMessage(error));
250
+ installExtensionResultsMap.set(key, { error, identifier: task.identifier, operation: task.operation, source: task.source, context: task.options.context, profileLocation: task.options.profileLocation, applicationScoped: task.options.isApplicationScoped });
251
+ this.logService.error('Error while installing the extension', task.identifier.id, getErrorMessage(error), ( (task.options.profileLocation.toString())));
264
252
  throw error;
265
253
  }
254
+ if (!URI.isUri(task.source)) {
255
+ const isUpdate = task.operation === InstallOperation.Update;
256
+ const durationSinceUpdate = isUpdate ? undefined : (( (new Date())).getTime() - task.source.lastUpdated) / 1000;
257
+ reportTelemetry(this.telemetryService, isUpdate ? 'extensionGallery:update' : 'extensionGallery:install', {
258
+ extensionData: getGalleryExtensionTelemetryData(task.source),
259
+ verificationStatus: task.verificationStatus,
260
+ duration: ( (new Date())).getTime() - startTime,
261
+ durationSinceUpdate,
262
+ source: task.options.context?.[EXTENSION_INSTALL_SOURCE_CONTEXT]
263
+ });
264
+ if (isWeb && task.operation !== InstallOperation.Update) {
265
+ try {
266
+ await this.galleryService.reportStatistic(local.manifest.publisher, local.manifest.name, local.manifest.version, StatisticType.Install);
267
+ }
268
+ catch (error) { }
269
+ }
270
+ }
271
+ installExtensionResultsMap.set(key, { local, identifier: task.identifier, operation: task.operation, source: task.source, context: task.options.context, profileLocation: task.options.profileLocation, applicationScoped: local.isApplicationScoped });
266
272
  }))));
267
273
  if (alreadyRequestedInstallations.length) {
268
274
  await this.joinAllSettled(alreadyRequestedInstallations);
@@ -290,7 +296,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
290
296
  }
291
297
  return allDepsOrPacks;
292
298
  };
293
- const getErrorResult = (task) => ({ identifier: task.identifier, operation: 2 , source: task.source, context: task.options.context, profileLocation: task.profileLocation, error });
299
+ const getErrorResult = (task) => ({ identifier: task.identifier, operation: InstallOperation.Install, source: task.source, context: task.options.context, profileLocation: task.options.profileLocation, error });
294
300
  const rollbackTasks = [];
295
301
  for (const [key, { task, root }] of installingExtensionsMap) {
296
302
  const result = installExtensionResultsMap.get(key);
@@ -298,8 +304,8 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
298
304
  task.cancel();
299
305
  installExtensionResultsMap.set(key, getErrorResult(task));
300
306
  }
301
- else if (result.local && root && !installExtensionResultsMap.get(`${root.identifier.id.toLowerCase()}-${( (task.profileLocation.toString()))}`)?.local) {
302
- rollbackTasks.push(this.createUninstallExtensionTask(result.local, { versionOnly: true, profileLocation: task.profileLocation }));
307
+ else if (result.local && root && !installExtensionResultsMap.get(`${root.identifier.id.toLowerCase()}-${( (task.options.profileLocation.toString()))}`)?.local) {
308
+ rollbackTasks.push(this.createUninstallExtensionTask(result.local, { versionOnly: true, profileLocation: task.options.profileLocation }));
303
309
  installExtensionResultsMap.set(key, getErrorResult(task));
304
310
  }
305
311
  }
@@ -311,11 +317,11 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
311
317
  if (task.options.donotIncludePackAndDependencies) {
312
318
  continue;
313
319
  }
314
- const depsOrPacks = getAllDepsAndPacks(result.local, task.profileLocation, [result.local.identifier.id.toLowerCase()]).slice(1);
320
+ const depsOrPacks = getAllDepsAndPacks(result.local, task.options.profileLocation, [result.local.identifier.id.toLowerCase()]).slice(1);
315
321
  if (( (depsOrPacks.some(depOrPack => ( (installingExtensionsMap.has(
316
- `${depOrPack.toLowerCase()}-${( (task.profileLocation.toString()))}`
317
- ))) && !installExtensionResultsMap.get(`${depOrPack.toLowerCase()}-${( (task.profileLocation.toString()))}`)?.local)))) {
318
- rollbackTasks.push(this.createUninstallExtensionTask(result.local, { versionOnly: true, profileLocation: task.profileLocation }));
322
+ `${depOrPack.toLowerCase()}-${( (task.options.profileLocation.toString()))}`
323
+ ))) && !installExtensionResultsMap.get(`${depOrPack.toLowerCase()}-${( (task.options.profileLocation.toString()))}`)?.local)))) {
324
+ rollbackTasks.push(this.createUninstallExtensionTask(result.local, { versionOnly: true, profileLocation: task.options.profileLocation }));
319
325
  installExtensionResultsMap.set(key, getErrorResult(task));
320
326
  }
321
327
  }
@@ -335,14 +341,14 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
335
341
  finally {
336
342
  for (const { task } of ( (installingExtensionsMap.values()))) {
337
343
  if (task.source && !URI.isUri(task.source)) {
338
- this.installingExtensions.delete(getInstallExtensionTaskKey(task.source, task.profileLocation));
344
+ this.installingExtensions.delete(getInstallExtensionTaskKey(task.source, task.options.profileLocation));
339
345
  }
340
346
  }
341
347
  if (installExtensionResultsMap.size) {
342
348
  const results = [...( (installExtensionResultsMap.values()))];
343
349
  for (const result of results) {
344
350
  if (result.local) {
345
- this.logService.info(`Extension installed successfully:`, result.identifier.id);
351
+ this.logService.info(`Extension installed successfully:`, result.identifier.id, ( (result.profileLocation.toString())));
346
352
  }
347
353
  }
348
354
  this._onDidInstallExtensions.fire(results);
@@ -365,7 +371,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
365
371
  }
366
372
  return true;
367
373
  }
368
- async joinAllSettled(promises) {
374
+ async joinAllSettled(promises, errorCode) {
369
375
  const results = [];
370
376
  const errors = [];
371
377
  const promiseResults = await Promise.allSettled(promises);
@@ -374,24 +380,23 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
374
380
  results.push(r.value);
375
381
  }
376
382
  else {
377
- errors.push(r.reason);
383
+ errors.push(toExtensionManagementError(r.reason, errorCode));
378
384
  }
379
385
  }
380
- if (errors.length) {
381
- if (errors.length === 1) {
382
- throw errors[0];
383
- }
384
- let error = ( (new ExtensionManagementError('', ExtensionManagementErrorCode.Unknown)));
385
- for (const current of errors) {
386
- const code = current instanceof ExtensionManagementError ? current.code : ExtensionManagementErrorCode.Unknown;
387
- error = ( (new ExtensionManagementError(
388
- current.message ? `${current.message}, ${error.message}` : error.message,
389
- code !== ExtensionManagementErrorCode.Unknown && code !== ExtensionManagementErrorCode.Internal ? code : error.code
390
- )));
391
- }
392
- throw error;
386
+ if (!errors.length) {
387
+ return results;
393
388
  }
394
- return results;
389
+ if (errors.length === 1) {
390
+ throw errors[0];
391
+ }
392
+ let error = ( (new ExtensionManagementError('', ExtensionManagementErrorCode.Unknown)));
393
+ for (const current of errors) {
394
+ error = ( (new ExtensionManagementError(
395
+ error.message ? `${error.message}, ${current.message}` : current.message,
396
+ current.code !== ExtensionManagementErrorCode.Unknown && current.code !== ExtensionManagementErrorCode.Internal ? current.code : error.code
397
+ )));
398
+ }
399
+ throw error;
395
400
  }
396
401
  async getAllDepsAndPackExtensions(extensionIdentifier, manifest, getOnlyNewlyAddedFromExtensionPack, installPreRelease, profile, productVersion) {
397
402
  if (!this.galleryService.isEnabled()) {
@@ -584,7 +589,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
584
589
  const processedTasks = [];
585
590
  try {
586
591
  allTasks.push(createUninstallExtensionTask(extension));
587
- const installed = await this.getInstalled(1 , uninstallOptions.profileLocation);
592
+ const installed = await this.getInstalled(ExtensionType.User, uninstallOptions.profileLocation);
588
593
  if (uninstallOptions.donotIncludePack) {
589
594
  this.logService.info('Uninstalling the extension without including packed extension', `${extension.identifier.id}@${extension.manifest.version}`);
590
595
  }
@@ -613,7 +618,7 @@ let AbstractExtensionManagementService = class AbstractExtensionManagementServic
613
618
  ))));
614
619
  if (task.extension.identifier.uuid) {
615
620
  try {
616
- await this.galleryService.reportStatistic(task.extension.manifest.publisher, task.extension.manifest.name, task.extension.manifest.version, "uninstall" );
621
+ await this.galleryService.reportStatistic(task.extension.manifest.publisher, task.extension.manifest.name, task.extension.manifest.version, StatisticType.Uninstall);
617
622
  }
618
623
  catch (error) { }
619
624
  }
@@ -765,23 +770,27 @@ AbstractExtensionManagementService = ( (__decorate([
765
770
  ( (__param(4, IProductService))),
766
771
  ( (__param(5, IUserDataProfilesService)))
767
772
  ], AbstractExtensionManagementService)));
768
- function toExtensionManagementError(error) {
773
+ function toExtensionManagementError(error, code) {
769
774
  if (error instanceof ExtensionManagementError) {
770
775
  return error;
771
776
  }
777
+ let extensionManagementError;
772
778
  if (error instanceof ExtensionGalleryError) {
773
- const e = ( (new ExtensionManagementError(error.message, ExtensionManagementErrorCode.Gallery)));
774
- e.stack = error.stack;
775
- return e;
779
+ extensionManagementError = ( (new ExtensionManagementError(
780
+ error.message,
781
+ error.code === ExtensionGalleryErrorCode.DownloadFailedWriting ? ExtensionManagementErrorCode.DownloadFailedWriting : ExtensionManagementErrorCode.Gallery
782
+ )));
783
+ }
784
+ else {
785
+ extensionManagementError = ( (new ExtensionManagementError(
786
+ error.message,
787
+ isCancellationError(error) ? ExtensionManagementErrorCode.Cancelled : (code ?? ExtensionManagementErrorCode.Internal)
788
+ )));
776
789
  }
777
- const e = ( (new ExtensionManagementError(
778
- error.message,
779
- isCancellationError(error) ? ExtensionManagementErrorCode.Cancelled : ExtensionManagementErrorCode.Internal
780
- )));
781
- e.stack = error.stack;
782
- return e;
790
+ extensionManagementError.stack = error.stack;
791
+ return extensionManagementError;
783
792
  }
784
- function reportTelemetry(telemetryService, eventName, { extensionData, verificationStatus, duration, error, durationSinceUpdate }) {
793
+ function reportTelemetry(telemetryService, eventName, { extensionData, verificationStatus, duration, error, source, durationSinceUpdate }) {
785
794
  let errorcode;
786
795
  let errorcodeDetail;
787
796
  if (isDefined(verificationStatus)) {
@@ -803,7 +812,7 @@ function reportTelemetry(telemetryService, eventName, { extensionData, verificat
803
812
  errorcodeDetail = error.message;
804
813
  }
805
814
  }
806
- telemetryService.publicLog(eventName, { ...extensionData, verificationStatus, success: !error, duration, errorcode, errorcodeDetail, durationSinceUpdate });
815
+ telemetryService.publicLog(eventName, { ...extensionData, verificationStatus, success: !error, duration, errorcode, errorcodeDetail, durationSinceUpdate, source });
807
816
  }
808
817
  class AbstractExtensionTask {
809
818
  constructor() {
@@ -8,8 +8,9 @@ import { isBoolean } from 'vscode/vscode/vs/base/common/types';
8
8
  import { URI } from 'vscode/vscode/vs/base/common/uri';
9
9
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
10
10
  import { IEnvironmentService } from 'vscode/vscode/vs/platform/environment/common/environment.service';
11
- import { getTargetPlatform, toTargetPlatform, WEB_EXTENSION_TAG, isNotWebExtensionInWebTargetPlatform, isTargetPlatformCompatible, ExtensionGalleryErrorCode, ExtensionGalleryError } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
11
+ import { getTargetPlatform, SortBy, SortOrder, toTargetPlatform, WEB_EXTENSION_TAG, isNotWebExtensionInWebTargetPlatform, isTargetPlatformCompatible, ExtensionGalleryErrorCode, ExtensionGalleryError, StatisticType, InstallOperation } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
12
12
  import { adoptToGalleryExtensionId, getGalleryExtensionId, areSameExtensions, getGalleryExtensionTelemetryData } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
13
+ import { TargetPlatform } from 'vscode/vscode/vs/platform/extensions/common/extensions';
13
14
  import { isEngineValid } from 'vscode/vscode/vs/platform/extensions/common/extensionValidator';
14
15
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
15
16
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
@@ -21,7 +22,7 @@ import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storag
21
22
  import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
22
23
  import { StopWatch } from 'vscode/vscode/vs/base/common/stopwatch';
23
24
 
24
- const CURRENT_TARGET_PLATFORM = isWeb ? "web" : getTargetPlatform(platform, arch);
25
+ const CURRENT_TARGET_PLATFORM = isWeb ? TargetPlatform.WEB : getTargetPlatform(platform, arch);
25
26
  const ACTIVITY_HEADER_NAME = 'X-Market-Search-Activity-Id';
26
27
  var Flags;
27
28
  ( (function(Flags) {
@@ -77,8 +78,8 @@ const DefaultPageSize = 10;
77
78
  const DefaultQueryState = {
78
79
  pageNumber: 1,
79
80
  pageSize: DefaultPageSize,
80
- sortBy: 0 ,
81
- sortOrder: 0 ,
81
+ sortBy: SortBy.NoneOrRelevance,
82
+ sortOrder: SortOrder.Default,
82
83
  flags: Flags.None,
83
84
  criteria: [],
84
85
  assetTypes: []
@@ -204,15 +205,15 @@ function getIsPreview(flags) {
204
205
  return flags.indexOf('preview') !== -1;
205
206
  }
206
207
  function getTargetPlatformForExtensionVersion(version) {
207
- return version.targetPlatform ? toTargetPlatform(version.targetPlatform) : "undefined" ;
208
+ return version.targetPlatform ? toTargetPlatform(version.targetPlatform) : TargetPlatform.UNDEFINED;
208
209
  }
209
210
  function getAllTargetPlatforms(rawGalleryExtension) {
210
211
  const allTargetPlatforms = distinct(( rawGalleryExtension.versions.map(getTargetPlatformForExtensionVersion)));
211
212
  const isWebExtension = !!rawGalleryExtension.tags?.includes(WEB_EXTENSION_TAG);
212
- const webTargetPlatformIndex = allTargetPlatforms.indexOf("web" );
213
+ const webTargetPlatformIndex = allTargetPlatforms.indexOf(TargetPlatform.WEB);
213
214
  if (isWebExtension) {
214
215
  if (webTargetPlatformIndex === -1) {
215
- allTargetPlatforms.push("web" );
216
+ allTargetPlatforms.push(TargetPlatform.WEB);
216
217
  }
217
218
  }
218
219
  else {
@@ -258,6 +259,7 @@ function toExtension(galleryExtension, version, allTargetPlatforms, queryContext
258
259
  coreTranslations: getCoreTranslationAssets(version)
259
260
  };
260
261
  return {
262
+ type: 'gallery',
261
263
  identifier: {
262
264
  id: getGalleryExtensionId(galleryExtension.publisher.publisherName, galleryExtension.extensionName),
263
265
  uuid: galleryExtension.extensionId
@@ -435,7 +437,7 @@ let AbstractExtensionGalleryService = class AbstractExtensionGalleryService {
435
437
  text = text.length < 200 ? text : text.substring(0, 200);
436
438
  query = query.withFilter(FilterType.SearchText, text);
437
439
  }
438
- query = query.withSortBy(0 );
440
+ query = query.withSortBy(SortBy.NoneOrRelevance);
439
441
  }
440
442
  else if (options.ids) {
441
443
  query = query.withFilter(FilterType.ExtensionId, ...options.ids);
@@ -444,7 +446,7 @@ let AbstractExtensionGalleryService = class AbstractExtensionGalleryService {
444
446
  query = query.withFilter(FilterType.ExtensionName, ...options.names);
445
447
  }
446
448
  else {
447
- query = query.withSortBy(4 );
449
+ query = query.withSortBy(SortBy.InstallCount);
448
450
  }
449
451
  if (typeof options.sortBy === 'number') {
450
452
  query = query.withSortBy(options.sortBy);
@@ -575,7 +577,7 @@ let AbstractExtensionGalleryService = class AbstractExtensionGalleryService {
575
577
  'Content-Length': String(data.length),
576
578
  };
577
579
  const stopWatch = ( new StopWatch());
578
- let context, error, total = 0;
580
+ let context, errorCode, total = 0;
579
581
  try {
580
582
  context = await this.requestService.request({
581
583
  type: 'POST',
@@ -603,9 +605,15 @@ let AbstractExtensionGalleryService = class AbstractExtensionGalleryService {
603
605
  return { galleryExtensions: [], total };
604
606
  }
605
607
  catch (e) {
606
- const errorCode = isCancellationError(e) ? ExtensionGalleryErrorCode.Cancelled : getErrorMessage(e).startsWith('XHR timeout') ? ExtensionGalleryErrorCode.Timeout : ExtensionGalleryErrorCode.Failed;
607
- error = ( new ExtensionGalleryError(getErrorMessage(e), errorCode));
608
- throw error;
608
+ if (isCancellationError(e)) {
609
+ errorCode = ExtensionGalleryErrorCode.Cancelled;
610
+ throw e;
611
+ }
612
+ else {
613
+ const errorMessage = getErrorMessage(e);
614
+ errorCode = errorMessage.startsWith('XHR timeout') ? ExtensionGalleryErrorCode.Timeout : ExtensionGalleryErrorCode.Failed;
615
+ throw ( new ExtensionGalleryError(errorMessage, errorCode));
616
+ }
609
617
  }
610
618
  finally {
611
619
  this.telemetryService.publicLog2('galleryService:query', {
@@ -615,7 +623,7 @@ let AbstractExtensionGalleryService = class AbstractExtensionGalleryService {
615
623
  success: !!context && isSuccess(context),
616
624
  responseBodySize: context?.res.headers['Content-Length'],
617
625
  statusCode: context ? String(context.res.statusCode) : undefined,
618
- errorCode: error?.code,
626
+ errorCode,
619
627
  count: String(total)
620
628
  });
621
629
  }
@@ -624,7 +632,7 @@ let AbstractExtensionGalleryService = class AbstractExtensionGalleryService {
624
632
  if (!this.isEnabled()) {
625
633
  return undefined;
626
634
  }
627
- const url = isWeb ? this.api(`/itemName/${publisher}.${name}/version/${version}/statType/${type === "install" ? '1' : '3'}/vscodewebextension`) : this.api(`/publishers/${publisher}/extensions/${name}/${version}/stats?statType=${type}`);
635
+ const url = isWeb ? this.api(`/itemName/${publisher}.${name}/version/${version}/statType/${type === StatisticType.Install ? '1' : '3'}/vscodewebextension`) : this.api(`/publishers/${publisher}/extensions/${name}/${version}/stats?statType=${type}`);
628
636
  const Accept = isWeb ? 'api-version=6.1-preview.1' : '*/*;api-version=4.0-preview.1';
629
637
  const commonHeaders = await this.commonHeadersPromise;
630
638
  const headers = { ...commonHeaders, Accept };
@@ -641,16 +649,26 @@ let AbstractExtensionGalleryService = class AbstractExtensionGalleryService {
641
649
  this.logService.trace('ExtensionGalleryService#download', extension.identifier.id);
642
650
  const data = getGalleryExtensionTelemetryData(extension);
643
651
  const startTime = ( new Date()).getTime();
644
- const log = (duration) => this.telemetryService.publicLog('galleryService:downloadVSIX', { ...data, duration });
645
- const operationParam = operation === 2 ? 'install' : operation === 3 ? 'update' : '';
652
+ const operationParam = operation === InstallOperation.Install ? 'install' : operation === InstallOperation.Update ? 'update' : '';
646
653
  const downloadAsset = operationParam ? {
647
654
  uri: `${extension.assets.download.uri}${( URI.parse(extension.assets.download.uri)).query ? '&' : '?'}${operationParam}=true`,
648
655
  fallbackUri: `${extension.assets.download.fallbackUri}${( URI.parse(extension.assets.download.fallbackUri)).query ? '&' : '?'}${operationParam}=true`
649
656
  } : extension.assets.download;
650
657
  const headers = extension.queryContext?.[ACTIVITY_HEADER_NAME] ? { [ACTIVITY_HEADER_NAME]: extension.queryContext[ACTIVITY_HEADER_NAME] } : undefined;
651
658
  const context = await this.getAsset(extension.identifier.id, downloadAsset, AssetType.VSIX, headers ? { headers } : undefined);
652
- await this.fileService.writeFile(location, context.stream);
653
- log(( new Date()).getTime() - startTime);
659
+ try {
660
+ await this.fileService.writeFile(location, context.stream);
661
+ }
662
+ catch (error) {
663
+ try {
664
+ await this.fileService.del(location);
665
+ }
666
+ catch (e) {
667
+ this.logService.warn(`Error while deleting the file ${( location.toString())}`, getErrorMessage(e));
668
+ }
669
+ throw ( new ExtensionGalleryError(getErrorMessage(error), ExtensionGalleryErrorCode.DownloadFailedWriting));
670
+ }
671
+ this.telemetryService.publicLog('galleryService:downloadVSIX', { ...data, duration: ( new Date()).getTime() - startTime });
654
672
  }
655
673
  async downloadSignatureArchive(extension, location) {
656
674
  if (!extension.assets.signature) {
@@ -658,7 +676,18 @@ let AbstractExtensionGalleryService = class AbstractExtensionGalleryService {
658
676
  }
659
677
  this.logService.trace('ExtensionGalleryService#downloadSignatureArchive', extension.identifier.id);
660
678
  const context = await this.getAsset(extension.identifier.id, extension.assets.signature, AssetType.Signature);
661
- await this.fileService.writeFile(location, context.stream);
679
+ try {
680
+ await this.fileService.writeFile(location, context.stream);
681
+ }
682
+ catch (error) {
683
+ try {
684
+ await this.fileService.del(location);
685
+ }
686
+ catch (e) {
687
+ this.logService.warn(`Error while deleting the file ${( location.toString())}`, getErrorMessage(e));
688
+ }
689
+ throw ( new ExtensionGalleryError(getErrorMessage(error), ExtensionGalleryErrorCode.DownloadFailedWriting));
690
+ }
662
691
  }
663
692
  async getReadme(extension, token) {
664
693
  if (extension.assets.readme) {
@@ -2,6 +2,8 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
2
  import 'vscode/vscode/vs/base/common/arrays';
3
3
  import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
4
4
  import { joinPath } from 'vscode/vscode/vs/base/common/resources';
5
+ import 'vscode/vscode/vs/base/common/charCode';
6
+ import 'vscode/vscode/vs/base/common/marshallingIds';
5
7
  import 'vscode/vscode/vs/base/common/path';
6
8
  import 'vscode/vscode/vs/base/common/platform';
7
9
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
@@ -11,7 +13,11 @@ import 'vscode/vscode/vs/base/common/event';
11
13
  import 'vscode/vscode/vs/base/common/process';
12
14
  import 'vscode/vscode/vs/base/common/strings';
13
15
  import 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
16
+ import 'vscode/vscode/vs/platform/extensions/common/extensions';
14
17
  import 'vscode/vscode/vs/base/common/network';
18
+ import 'vscode/vscode/vs/platform/telemetry/common/telemetry';
19
+ import '../../extensionRecommendations/common/extensionRecommendations.js';
20
+ import 'vscode/vscode/vs/platform/storage/common/storage';
15
21
 
16
22
  let ExtensionTipsService = class ExtensionTipsService extends Disposable {
17
23
  constructor(fileService, productService) {
@@ -1,5 +1,7 @@
1
1
  import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
2
+ import { InstallOperation } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
2
3
  import { areSameExtensions, getExtensionId } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
4
+ import { ExtensionType } from 'vscode/vscode/vs/platform/extensions/common/extensions';
3
5
 
4
6
  async function migrateUnsupportedExtensions(extensionManagementService, galleryService, extensionStorageService, extensionEnablementService, logService) {
5
7
  try {
@@ -7,7 +9,7 @@ async function migrateUnsupportedExtensions(extensionManagementService, galleryS
7
9
  if (!extensionsControlManifest.deprecated) {
8
10
  return;
9
11
  }
10
- const installed = await extensionManagementService.getInstalled(1 );
12
+ const installed = await extensionManagementService.getInstalled(ExtensionType.User);
11
13
  for (const [unsupportedExtensionId, deprecated] of Object.entries(extensionsControlManifest.deprecated)) {
12
14
  if (!deprecated?.extension) {
13
15
  continue;
@@ -32,7 +34,7 @@ async function migrateUnsupportedExtensions(extensionManagementService, galleryS
32
34
  logService.info(`Uninstalled the unsupported extension '${unsupportedExtension.identifier.id}'`);
33
35
  let preReleaseExtension = installed.find(i => areSameExtensions(i.identifier, { id: preReleaseExtensionId }));
34
36
  if (!preReleaseExtension || (!preReleaseExtension.isPreReleaseVersion && isUnsupportedExtensionEnabled)) {
35
- preReleaseExtension = await extensionManagementService.installFromGallery(gallery, { installPreReleaseVersion: true, isMachineScoped: unsupportedExtension.isMachineScoped, operation: 4 });
37
+ preReleaseExtension = await extensionManagementService.installFromGallery(gallery, { installPreReleaseVersion: true, isMachineScoped: unsupportedExtension.isMachineScoped, operation: InstallOperation.Migrate });
36
38
  logService.info(`Installed the pre-release extension '${preReleaseExtension.identifier.id}'`);
37
39
  if (!isUnsupportedExtensionEnabled) {
38
40
  await extensionEnablementService.disableExtension(preReleaseExtension.identifier);
@@ -1,9 +1,25 @@
1
+ var RecommendationSource;
2
+ ( (function(RecommendationSource) {
3
+ RecommendationSource[RecommendationSource["FILE"] = 1] = "FILE";
4
+ RecommendationSource[RecommendationSource["WORKSPACE"] = 2] = "WORKSPACE";
5
+ RecommendationSource[RecommendationSource["EXE"] = 3] = "EXE";
6
+ })(RecommendationSource || (RecommendationSource = {})));
1
7
  function RecommendationSourceToString(source) {
2
8
  switch (source) {
3
- case 1 : return 'file';
4
- case 2 : return 'workspace';
5
- case 3 : return 'exe';
9
+ case RecommendationSource.FILE: return 'file';
10
+ case RecommendationSource.WORKSPACE: return 'workspace';
11
+ case RecommendationSource.EXE: return 'exe';
6
12
  }
7
13
  }
14
+ var RecommendationsNotificationResult;
15
+ ( (function(RecommendationsNotificationResult) {
16
+ RecommendationsNotificationResult["Ignored"] = "ignored";
17
+ RecommendationsNotificationResult["Cancelled"] = "cancelled";
18
+ RecommendationsNotificationResult["TooMany"] = "toomany";
19
+ RecommendationsNotificationResult["IncompatibleWindow"] = "incompatibleWindow";
20
+ RecommendationsNotificationResult["Accepted"] = "reacted";
21
+ })(
22
+ RecommendationsNotificationResult || (RecommendationsNotificationResult = {})
23
+ ));
8
24
 
9
- export { RecommendationSourceToString };
25
+ export { RecommendationSource, RecommendationSourceToString, RecommendationsNotificationResult };
@@ -1,4 +1,5 @@
1
1
  import { getServiceMachineId } from 'vscode/vscode/vs/platform/externalServices/common/serviceMachineId';
2
+ import { TelemetryLevel } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
2
3
  import { supportsTelemetry, getTelemetryLevel } from 'vscode/vscode/vs/platform/telemetry/common/telemetryUtils';
3
4
 
4
5
  async function resolveMarketplaceHeaders(version, productService, environmentService, configurationService, fileService, storageService, telemetryService) {
@@ -6,7 +7,7 @@ async function resolveMarketplaceHeaders(version, productService, environmentSer
6
7
  'X-Market-Client-Id': `VSCode ${version}`,
7
8
  'User-Agent': `VSCode ${version} (${productService.nameShort})`
8
9
  };
9
- if (supportsTelemetry(productService, environmentService) && getTelemetryLevel(configurationService) === 3 ) {
10
+ if (supportsTelemetry(productService, environmentService) && getTelemetryLevel(configurationService) === TelemetryLevel.USAGE) {
10
11
  const serviceMachineId = await getServiceMachineId(environmentService, fileService, storageService);
11
12
  headers['X-Market-User-Id'] = serviceMachineId;
12
13
  headers['VSCode-SessionId'] = telemetryService.machineId || serviceMachineId;
@@ -1,6 +1,8 @@
1
1
  import { Emitter } from 'vscode/vscode/vs/base/common/event';
2
2
  import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
3
3
  import { reviveProfile } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile';
4
+ import 'vscode/vscode/vs/base/common/marshallingIds';
5
+ import 'vscode/vscode/vs/base/common/charCode';
4
6
  import 'vscode/vscode/vs/base/common/path';
5
7
  import 'vscode/vscode/vs/base/common/platform';
6
8
 
@@ -1,5 +1,6 @@
1
1
  import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
2
  import { distinct } from 'vscode/vscode/vs/base/common/arrays';
3
+ import { ConfigurationTarget } from 'vscode/vscode/vs/platform/configuration/common/configuration';
3
4
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
4
5
 
5
6
  let IgnoredExtensionsManagementService = class IgnoredExtensionsManagementService {
@@ -20,7 +21,7 @@ let IgnoredExtensionsManagementService = class IgnoredExtensionsManagementServic
20
21
  if (ignore) {
21
22
  currentValue.push(ignoredExtensionId.toLowerCase());
22
23
  }
23
- return this.configurationService.updateValue('settingsSync.ignoredExtensions', currentValue.length ? currentValue : undefined, 2 );
24
+ return this.configurationService.updateValue('settingsSync.ignoredExtensions', currentValue.length ? currentValue : undefined, ConfigurationTarget.USER);
24
25
  }
25
26
  updateSynchronizedExtensions(extensionId, sync) {
26
27
  let currentValue = ( [...this.configurationService.getValue('settingsSync.ignoredExtensions')].map(id => id.toLowerCase()));
@@ -28,7 +29,7 @@ let IgnoredExtensionsManagementService = class IgnoredExtensionsManagementServic
28
29
  if (sync) {
29
30
  currentValue.push(`-${extensionId.toLowerCase()}`);
30
31
  }
31
- return this.configurationService.updateValue('settingsSync.ignoredExtensions', currentValue.length ? currentValue : undefined, 2 );
32
+ return this.configurationService.updateValue('settingsSync.ignoredExtensions', currentValue.length ? currentValue : undefined, ConfigurationTarget.USER);
32
33
  }
33
34
  getIgnoredExtensions(installed) {
34
35
  const defaultIgnoredExtensions = ( installed.filter(i => i.isMachineScoped).map(i => i.identifier.id.toLowerCase()));