@codingame/monaco-vscode-extension-gallery-service-override 1.83.9

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 (66) hide show
  1. package/extensionGallery.d.ts +12 -0
  2. package/extensionGallery.js +76 -0
  3. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
  4. package/external/tslib/tslib.es6.js +11 -0
  5. package/index.d.ts +1 -0
  6. package/index.js +1 -0
  7. package/override/vs/platform/dialogs/common/dialogs.js +8 -0
  8. package/package.json +30 -0
  9. package/vscode/src/vs/platform/extensionManagement/common/abstractExtensionManagementService.js +784 -0
  10. package/vscode/src/vs/platform/extensionManagement/common/extensionEnablementService.js +142 -0
  11. package/vscode/src/vs/platform/extensionManagement/common/extensionGalleryService.js +855 -0
  12. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementIpc.js +119 -0
  13. package/vscode/src/vs/platform/extensionManagement/common/extensionTipsService.js +57 -0
  14. package/vscode/src/vs/platform/extensionManagement/common/unsupportedExtensionsMigration.js +58 -0
  15. package/vscode/src/vs/platform/externalServices/common/marketplace.js +17 -0
  16. package/vscode/src/vs/workbench/contrib/extensions/browser/abstractRuntimeExtensionsEditor.js +492 -0
  17. package/vscode/src/vs/workbench/contrib/extensions/browser/browserRuntimeExtensionsEditor.js +28 -0
  18. package/vscode/src/vs/workbench/contrib/extensions/browser/configBasedRecommendations.js +78 -0
  19. package/vscode/src/vs/workbench/contrib/extensions/browser/deprecatedExtensionsChecker.js +87 -0
  20. package/vscode/src/vs/workbench/contrib/extensions/browser/exeBasedRecommendations.js +60 -0
  21. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEditor.js +1868 -0
  22. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionEnablementWorkspaceTrustTransitionParticipant.js +52 -0
  23. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationNotificationService.js +437 -0
  24. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendations.js +17 -0
  25. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationsService.js +221 -0
  26. package/vscode/src/vs/workbench/contrib/extensions/browser/extensions.contribution.js +2063 -0
  27. package/vscode/src/vs/workbench/contrib/extensions/browser/extensions.web.contribution.js +13 -0
  28. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActivationProgress.js +46 -0
  29. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsCompletionItemsProvider.js +65 -0
  30. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsDependencyChecker.js +98 -0
  31. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsList.js +224 -0
  32. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsQuickAccess.js +121 -0
  33. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewer.js +285 -0
  34. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViewlet.js +912 -0
  35. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsViews.js +1270 -0
  36. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWidgets.js +824 -0
  37. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.js +1730 -0
  38. package/vscode/src/vs/workbench/contrib/extensions/browser/fileBasedRecommendations.js +324 -0
  39. package/vscode/src/vs/workbench/contrib/extensions/browser/keymapRecommendations.js +28 -0
  40. package/vscode/src/vs/workbench/contrib/extensions/browser/languageRecommendations.js +28 -0
  41. package/vscode/src/vs/workbench/contrib/extensions/browser/media/extension.css.js +6 -0
  42. package/vscode/src/vs/workbench/contrib/extensions/browser/media/extensionEditor.css.js +6 -0
  43. package/vscode/src/vs/workbench/contrib/extensions/browser/media/extensionsViewlet.css.js +6 -0
  44. package/vscode/src/vs/workbench/contrib/extensions/browser/media/extensionsWidgets.css.js +6 -0
  45. package/vscode/src/vs/workbench/contrib/extensions/browser/media/runtimeExtensionsEditor.css.js +6 -0
  46. package/vscode/src/vs/workbench/contrib/extensions/browser/remoteRecommendations.js +29 -0
  47. package/vscode/src/vs/workbench/contrib/extensions/browser/unsupportedExtensionsMigrationContribution.js +26 -0
  48. package/vscode/src/vs/workbench/contrib/extensions/browser/webRecommendations.js +38 -0
  49. package/vscode/src/vs/workbench/contrib/extensions/browser/workspaceRecommendations.js +88 -0
  50. package/vscode/src/vs/workbench/contrib/extensions/common/extensionQuery.js +67 -0
  51. package/vscode/src/vs/workbench/contrib/extensions/common/extensionsInput.js +43 -0
  52. package/vscode/src/vs/workbench/contrib/extensions/common/extensionsUtils.js +104 -0
  53. package/vscode/src/vs/workbench/contrib/extensions/common/reportExtensionIssueAction.js +31 -0
  54. package/vscode/src/vs/workbench/contrib/extensions/common/runtimeExtensionsInput.js +41 -0
  55. package/vscode/src/vs/workbench/contrib/markdown/browser/markdownDocumentRenderer.js +207 -0
  56. package/vscode/src/vs/workbench/contrib/update/common/update.js +3 -0
  57. package/vscode/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.js +84 -0
  58. package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.js +634 -0
  59. package/vscode/src/vs/workbench/services/extensionManagement/browser/webExtensionsScannerService.js +883 -0
  60. package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementChannelClient.js +109 -0
  61. package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementServerService.js +62 -0
  62. package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementService.js +633 -0
  63. package/vscode/src/vs/workbench/services/extensionManagement/common/remoteExtensionManagementService.js +58 -0
  64. package/vscode/src/vs/workbench/services/extensionManagement/common/webExtensionManagementService.js +269 -0
  65. package/vscode/src/vs/workbench/services/extensionRecommendations/common/extensionIgnoredRecommendationsService.js +83 -0
  66. package/vscode/src/vs/workbench/services/remote/common/remoteExtensionsScanner.js +73 -0
@@ -0,0 +1,58 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { IUriIdentityService } from 'monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js';
3
+ import { IRemoteUserDataProfilesService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/remoteUserDataProfiles';
4
+ import { ProfileAwareExtensionManagementChannelClient } from './extensionManagementChannelClient.js';
5
+ import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
6
+ import { IUserDataProfilesService } from 'monaco-editor/esm/vs/platform/userDataProfile/common/userDataProfile.js';
7
+
8
+ let RemoteExtensionManagementService = class RemoteExtensionManagementService extends ProfileAwareExtensionManagementChannelClient {
9
+ constructor(channel, userDataProfileService, userDataProfilesService, remoteUserDataProfilesService, uriIdentityService) {
10
+ super(channel, userDataProfileService, uriIdentityService);
11
+ this.userDataProfilesService = userDataProfilesService;
12
+ this.remoteUserDataProfilesService = remoteUserDataProfilesService;
13
+ }
14
+ async filterEvent(e) {
15
+ if (e.applicationScoped) {
16
+ return true;
17
+ }
18
+ if (!e.profileLocation && this.userDataProfileService.currentProfile.isDefault) {
19
+ return true;
20
+ }
21
+ const currentRemoteProfile = await this.remoteUserDataProfilesService.getRemoteProfile(this.userDataProfileService.currentProfile);
22
+ if (this.uriIdentityService.extUri.isEqual(currentRemoteProfile.extensionsResource, e.profileLocation)) {
23
+ return true;
24
+ }
25
+ return false;
26
+ }
27
+ async getProfileLocation(profileLocation) {
28
+ if (!profileLocation && this.userDataProfileService.currentProfile.isDefault) {
29
+ return undefined;
30
+ }
31
+ profileLocation = await super.getProfileLocation(profileLocation);
32
+ let profile = this.userDataProfilesService.profiles.find(p => this.uriIdentityService.extUri.isEqual(p.extensionsResource, profileLocation));
33
+ if (profile) {
34
+ profile = await this.remoteUserDataProfilesService.getRemoteProfile(profile);
35
+ }
36
+ else {
37
+ profile = (await this.remoteUserDataProfilesService.getRemoteProfiles()).find(p => this.uriIdentityService.extUri.isEqual(p.extensionsResource, profileLocation));
38
+ }
39
+ return profile?.extensionsResource;
40
+ }
41
+ async switchExtensionsProfile(previousProfileLocation, currentProfileLocation, preserveExtensions) {
42
+ const remoteProfiles = await this.remoteUserDataProfilesService.getRemoteProfiles();
43
+ const previousProfile = remoteProfiles.find(p => this.uriIdentityService.extUri.isEqual(p.extensionsResource, previousProfileLocation));
44
+ const currentProfile = remoteProfiles.find(p => this.uriIdentityService.extUri.isEqual(p.extensionsResource, currentProfileLocation));
45
+ if (previousProfile?.id === currentProfile?.id) {
46
+ return { added: [], removed: [] };
47
+ }
48
+ return super.switchExtensionsProfile(previousProfileLocation, currentProfileLocation, preserveExtensions);
49
+ }
50
+ };
51
+ RemoteExtensionManagementService = ( __decorate([
52
+ ( __param(1, IUserDataProfileService)),
53
+ ( __param(2, IUserDataProfilesService)),
54
+ ( __param(3, IRemoteUserDataProfilesService)),
55
+ ( __param(4, IUriIdentityService))
56
+ ], RemoteExtensionManagementService));
57
+
58
+ export { RemoteExtensionManagementService };
@@ -0,0 +1,269 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { ExtensionIdentifier } from 'monaco-editor/esm/vs/platform/extensions/common/extensions.js';
3
+ import { IExtensionGalleryService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
4
+ import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
5
+ import { Event, Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
6
+ import { getGalleryExtensionId, areSameExtensions } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
7
+ import { IWebExtensionsScannerService } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionManagement';
8
+ import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
9
+ import { AbstractExtensionManagementService, toExtensionManagementError, AbstractExtensionTask } from '../../../../platform/extensionManagement/common/abstractExtensionManagementService.js';
10
+ import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
11
+ import { IExtensionManifestPropertiesService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionManifestPropertiesService';
12
+ import { IProductService } from 'monaco-editor/esm/vs/platform/product/common/productService.js';
13
+ import { isUndefined, isBoolean } from 'monaco-editor/esm/vs/base/common/types.js';
14
+ import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
15
+ import { delta } from 'monaco-editor/esm/vs/base/common/arrays.js';
16
+ import { compare } from 'monaco-editor/esm/vs/base/common/strings.js';
17
+ import { IUserDataProfilesService } from 'monaco-editor/esm/vs/platform/userDataProfile/common/userDataProfile.js';
18
+ import { IUriIdentityService } from 'monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js';
19
+ import { DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
20
+
21
+ let WebExtensionManagementService = class WebExtensionManagementService extends AbstractExtensionManagementService {
22
+ get onProfileAwareInstallExtension() { return super.onInstallExtension; }
23
+ get onInstallExtension() { return Event.filter(this.onProfileAwareInstallExtension, e => this.filterEvent(e), this.disposables); }
24
+ get onProfileAwareDidInstallExtensions() { return super.onDidInstallExtensions; }
25
+ get onDidInstallExtensions() {
26
+ return Event.filter(( Event.map(
27
+ this.onProfileAwareDidInstallExtensions,
28
+ results => results.filter(e => this.filterEvent(e)),
29
+ this.disposables
30
+ )), results => results.length > 0, this.disposables);
31
+ }
32
+ get onProfileAwareUninstallExtension() { return super.onUninstallExtension; }
33
+ get onUninstallExtension() { return Event.filter(this.onProfileAwareUninstallExtension, e => this.filterEvent(e), this.disposables); }
34
+ get onProfileAwareDidUninstallExtension() { return super.onDidUninstallExtension; }
35
+ get onDidUninstallExtension() { return Event.filter(this.onProfileAwareDidUninstallExtension, e => this.filterEvent(e), this.disposables); }
36
+ constructor(extensionGalleryService, telemetryService, logService, webExtensionsScannerService, extensionManifestPropertiesService, userDataProfileService, productService, userDataProfilesService, uriIdentityService) {
37
+ super(extensionGalleryService, telemetryService, uriIdentityService, logService, productService, userDataProfilesService);
38
+ this.webExtensionsScannerService = webExtensionsScannerService;
39
+ this.extensionManifestPropertiesService = extensionManifestPropertiesService;
40
+ this.userDataProfileService = userDataProfileService;
41
+ this.disposables = this._register(( new DisposableStore()));
42
+ this._onDidChangeProfile = this._register(( new Emitter()));
43
+ this.onDidChangeProfile = this._onDidChangeProfile.event;
44
+ this._register(userDataProfileService.onDidChangeCurrentProfile(e => {
45
+ if (!this.uriIdentityService.extUri.isEqual(e.previous.extensionsResource, e.profile.extensionsResource)) {
46
+ e.join(this.whenProfileChanged(e));
47
+ }
48
+ }));
49
+ }
50
+ filterEvent({ profileLocation, applicationScoped }) {
51
+ profileLocation = profileLocation ?? this.userDataProfileService.currentProfile.extensionsResource;
52
+ return applicationScoped || this.uriIdentityService.extUri.isEqual(this.userDataProfileService.currentProfile.extensionsResource, profileLocation);
53
+ }
54
+ async getTargetPlatform() {
55
+ return "web" ;
56
+ }
57
+ async canInstall(gallery) {
58
+ if (await super.canInstall(gallery)) {
59
+ return true;
60
+ }
61
+ if (this.isConfiguredToExecuteOnWeb(gallery)) {
62
+ return true;
63
+ }
64
+ return false;
65
+ }
66
+ async getInstalled(type, profileLocation) {
67
+ const extensions = [];
68
+ if (type === undefined || type === 0 ) {
69
+ const systemExtensions = await this.webExtensionsScannerService.scanSystemExtensions();
70
+ extensions.push(...systemExtensions);
71
+ }
72
+ if (type === undefined || type === 1 ) {
73
+ const userExtensions = await this.webExtensionsScannerService.scanUserExtensions(profileLocation ?? this.userDataProfileService.currentProfile.extensionsResource);
74
+ extensions.push(...userExtensions);
75
+ }
76
+ return ( extensions.map(e => toLocalExtension(e)));
77
+ }
78
+ async install(location, options = {}) {
79
+ this.logService.trace('ExtensionManagementService#install', ( location.toString()));
80
+ const manifest = await this.webExtensionsScannerService.scanExtensionManifest(location);
81
+ if (!manifest) {
82
+ throw new Error(`Cannot find packageJSON from the location ${location.toString()}`);
83
+ }
84
+ const result = await this.installExtensions([{ manifest, extension: location, options }]);
85
+ if (result[0]?.local) {
86
+ return result[0]?.local;
87
+ }
88
+ if (result[0]?.error) {
89
+ throw result[0].error;
90
+ }
91
+ throw toExtensionManagementError(new Error(`Unknown error while installing extension ${getGalleryExtensionId(manifest.publisher, manifest.name)}`));
92
+ }
93
+ installFromLocation(location, profileLocation) {
94
+ return this.install(location, { profileLocation });
95
+ }
96
+ async copyExtension(extension, fromProfileLocation, toProfileLocation, metadata) {
97
+ const target = await this.webExtensionsScannerService.scanExistingExtension(extension.location, extension.type, toProfileLocation);
98
+ const source = await this.webExtensionsScannerService.scanExistingExtension(extension.location, extension.type, fromProfileLocation);
99
+ metadata = { ...source?.metadata, ...metadata };
100
+ let scanned;
101
+ if (target) {
102
+ scanned = await this.webExtensionsScannerService.updateMetadata(extension, { ...target.metadata, ...metadata }, toProfileLocation);
103
+ }
104
+ else {
105
+ scanned = await this.webExtensionsScannerService.addExtension(extension.location, metadata, toProfileLocation);
106
+ }
107
+ return toLocalExtension(scanned);
108
+ }
109
+ async installExtensionsFromProfile(extensions, fromProfileLocation, toProfileLocation) {
110
+ const result = [];
111
+ const extensionsToInstall = (await this.webExtensionsScannerService.scanUserExtensions(fromProfileLocation))
112
+ .filter(e => ( extensions.some(id => areSameExtensions(id, e.identifier))));
113
+ if (extensionsToInstall.length) {
114
+ await Promise.allSettled(( extensionsToInstall.map(async (e) => {
115
+ let local = await this.installFromLocation(e.location, toProfileLocation);
116
+ if (e.metadata) {
117
+ local = await this.updateMetadata(local, e.metadata, fromProfileLocation);
118
+ }
119
+ result.push(local);
120
+ })));
121
+ }
122
+ return result;
123
+ }
124
+ async updateMetadata(local, metadata, profileLocation) {
125
+ metadata.isMachineScoped = metadata.isMachineScoped || undefined;
126
+ metadata.isBuiltin = metadata.isBuiltin || undefined;
127
+ metadata.pinned = metadata.pinned || undefined;
128
+ const updatedExtension = await this.webExtensionsScannerService.updateMetadata(local, metadata, profileLocation ?? this.userDataProfileService.currentProfile.extensionsResource);
129
+ const updatedLocalExtension = toLocalExtension(updatedExtension);
130
+ this._onDidUpdateExtensionMetadata.fire(updatedLocalExtension);
131
+ return updatedLocalExtension;
132
+ }
133
+ async copyExtensions(fromProfileLocation, toProfileLocation) {
134
+ await this.webExtensionsScannerService.copyExtensions(fromProfileLocation, toProfileLocation, e => !e.metadata?.isApplicationScoped);
135
+ }
136
+ async getCompatibleVersion(extension, sameVersion, includePreRelease) {
137
+ const compatibleExtension = await super.getCompatibleVersion(extension, sameVersion, includePreRelease);
138
+ if (compatibleExtension) {
139
+ return compatibleExtension;
140
+ }
141
+ if (this.isConfiguredToExecuteOnWeb(extension)) {
142
+ return extension;
143
+ }
144
+ return null;
145
+ }
146
+ isConfiguredToExecuteOnWeb(gallery) {
147
+ const configuredExtensionKind = this.extensionManifestPropertiesService.getUserConfiguredExtensionKind(gallery.identifier);
148
+ return !!configuredExtensionKind && configuredExtensionKind.includes('web');
149
+ }
150
+ getCurrentExtensionsManifestLocation() {
151
+ return this.userDataProfileService.currentProfile.extensionsResource;
152
+ }
153
+ createInstallExtensionTask(manifest, extension, options) {
154
+ return ( new InstallExtensionTask(
155
+ manifest,
156
+ extension,
157
+ options,
158
+ this.webExtensionsScannerService,
159
+ this.userDataProfilesService
160
+ ));
161
+ }
162
+ createUninstallExtensionTask(extension, options) {
163
+ return ( new UninstallExtensionTask(extension, options, this.webExtensionsScannerService));
164
+ }
165
+ zip(extension) { throw new Error('unsupported'); }
166
+ unzip(zipLocation) { throw new Error('unsupported'); }
167
+ getManifest(vsix) { throw new Error('unsupported'); }
168
+ download() { throw new Error('unsupported'); }
169
+ reinstallFromGallery() { throw new Error('unsupported'); }
170
+ async cleanUp() { }
171
+ async whenProfileChanged(e) {
172
+ const previousProfileLocation = e.previous.extensionsResource;
173
+ const currentProfileLocation = e.profile.extensionsResource;
174
+ if (!previousProfileLocation || !currentProfileLocation) {
175
+ throw new Error('This should not happen');
176
+ }
177
+ const oldExtensions = await this.webExtensionsScannerService.scanUserExtensions(previousProfileLocation);
178
+ const newExtensions = await this.webExtensionsScannerService.scanUserExtensions(currentProfileLocation);
179
+ const { added, removed } = delta(oldExtensions, newExtensions, (a, b) => compare(`${ExtensionIdentifier.toKey(a.identifier.id)}@${a.manifest.version}`, `${ExtensionIdentifier.toKey(b.identifier.id)}@${b.manifest.version}`));
180
+ this._onDidChangeProfile.fire({ added: ( added.map(e => toLocalExtension(e))), removed: ( removed.map(e => toLocalExtension(e))) });
181
+ }
182
+ };
183
+ WebExtensionManagementService = ( __decorate([
184
+ ( __param(0, IExtensionGalleryService)),
185
+ ( __param(1, ITelemetryService)),
186
+ ( __param(2, ILogService)),
187
+ ( __param(3, IWebExtensionsScannerService)),
188
+ ( __param(4, IExtensionManifestPropertiesService)),
189
+ ( __param(5, IUserDataProfileService)),
190
+ ( __param(6, IProductService)),
191
+ ( __param(7, IUserDataProfilesService)),
192
+ ( __param(8, IUriIdentityService))
193
+ ], WebExtensionManagementService));
194
+ function toLocalExtension(extension) {
195
+ const metadata = getMetadata(undefined, extension);
196
+ return {
197
+ ...extension,
198
+ identifier: { id: extension.identifier.id, uuid: metadata.id ?? extension.identifier.uuid },
199
+ isMachineScoped: !!metadata.isMachineScoped,
200
+ isApplicationScoped: !!metadata.isApplicationScoped,
201
+ publisherId: metadata.publisherId || null,
202
+ publisherDisplayName: metadata.publisherDisplayName || null,
203
+ installedTimestamp: metadata.installedTimestamp,
204
+ isPreReleaseVersion: !!metadata.isPreReleaseVersion,
205
+ preRelease: !!metadata.preRelease,
206
+ targetPlatform: "web" ,
207
+ updated: !!metadata.updated,
208
+ pinned: !!metadata?.pinned,
209
+ };
210
+ }
211
+ function getMetadata(options, existingExtension) {
212
+ const metadata = { ...(existingExtension?.metadata || {}) };
213
+ metadata.isMachineScoped = options?.isMachineScoped || metadata.isMachineScoped;
214
+ return metadata;
215
+ }
216
+ class InstallExtensionTask extends AbstractExtensionTask {
217
+ get profileLocation() { return this._profileLocation; }
218
+ get operation() { return isUndefined(this.options.operation) ? this._operation : this.options.operation; }
219
+ constructor(manifest, extension, options, webExtensionsScannerService, userDataProfilesService) {
220
+ super();
221
+ this.extension = extension;
222
+ this.options = options;
223
+ this.webExtensionsScannerService = webExtensionsScannerService;
224
+ this.userDataProfilesService = userDataProfilesService;
225
+ this._profileLocation = this.options.profileLocation;
226
+ this._operation = 2 ;
227
+ this.identifier = URI.isUri(extension) ? { id: getGalleryExtensionId(manifest.publisher, manifest.name) } : extension.identifier;
228
+ this.source = extension;
229
+ }
230
+ async doRun(token) {
231
+ const userExtensions = await this.webExtensionsScannerService.scanUserExtensions(this.options.profileLocation);
232
+ const existingExtension = userExtensions.find(e => areSameExtensions(e.identifier, this.identifier));
233
+ if (existingExtension) {
234
+ this._operation = 3 ;
235
+ }
236
+ const metadata = getMetadata(this.options, existingExtension);
237
+ if (!URI.isUri(this.extension)) {
238
+ metadata.id = this.extension.identifier.uuid;
239
+ metadata.publisherDisplayName = this.extension.publisherDisplayName;
240
+ metadata.publisherId = this.extension.publisherId;
241
+ metadata.installedTimestamp = Date.now();
242
+ metadata.isPreReleaseVersion = this.extension.properties.isPreReleaseVersion;
243
+ metadata.isBuiltin = this.options.isBuiltin || existingExtension?.isBuiltin;
244
+ metadata.isSystem = existingExtension?.type === 0 ? true : undefined;
245
+ metadata.updated = !!existingExtension;
246
+ metadata.isApplicationScoped = this.options.isApplicationScoped || metadata.isApplicationScoped;
247
+ metadata.preRelease = this.extension.properties.isPreReleaseVersion ||
248
+ ((isBoolean(this.options.installPreReleaseVersion) ? this.options.installPreReleaseVersion : metadata?.preRelease) );
249
+ }
250
+ metadata.pinned = this.options.installGivenVersion ? true : undefined;
251
+ this._profileLocation = metadata.isApplicationScoped ? this.userDataProfilesService.defaultProfile.extensionsResource : this.options.profileLocation;
252
+ const scannedExtension = URI.isUri(this.extension) ? await this.webExtensionsScannerService.addExtension(this.extension, metadata, this.profileLocation)
253
+ : await this.webExtensionsScannerService.addExtensionFromGallery(this.extension, metadata, this.profileLocation);
254
+ return toLocalExtension(scannedExtension);
255
+ }
256
+ }
257
+ class UninstallExtensionTask extends AbstractExtensionTask {
258
+ constructor(extension, options, webExtensionsScannerService) {
259
+ super();
260
+ this.extension = extension;
261
+ this.options = options;
262
+ this.webExtensionsScannerService = webExtensionsScannerService;
263
+ }
264
+ doRun(token) {
265
+ return this.webExtensionsScannerService.removeExtension(this.extension, this.options.profileLocation);
266
+ }
267
+ }
268
+
269
+ export { WebExtensionManagementService };
@@ -0,0 +1,83 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { distinct } from 'monaco-editor/esm/vs/base/common/arrays.js';
3
+ import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
4
+ import { Disposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
5
+ import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
6
+ import { IWorkspaceExtensionsConfigService } from 'vscode/vscode/vs/workbench/services/extensionRecommendations/common/workspaceExtensionsConfig';
7
+
8
+ const ignoredRecommendationsStorageKey = 'extensionsAssistant/ignored_recommendations';
9
+ let ExtensionIgnoredRecommendationsService = class ExtensionIgnoredRecommendationsService extends Disposable {
10
+ get globalIgnoredRecommendations() { return [...this._globalIgnoredRecommendations]; }
11
+ get ignoredRecommendations() { return distinct([...this.globalIgnoredRecommendations, ...this.ignoredWorkspaceRecommendations]); }
12
+ constructor(workspaceExtensionsConfigService, storageService) {
13
+ super();
14
+ this.workspaceExtensionsConfigService = workspaceExtensionsConfigService;
15
+ this.storageService = storageService;
16
+ this._onDidChangeIgnoredRecommendations = this._register(( new Emitter()));
17
+ this.onDidChangeIgnoredRecommendations = this._onDidChangeIgnoredRecommendations.event;
18
+ this._globalIgnoredRecommendations = [];
19
+ this._onDidChangeGlobalIgnoredRecommendation = this._register(( new Emitter()));
20
+ this.onDidChangeGlobalIgnoredRecommendation = this._onDidChangeGlobalIgnoredRecommendation.event;
21
+ this.ignoredWorkspaceRecommendations = [];
22
+ this._globalIgnoredRecommendations = this.getCachedIgnoredRecommendations();
23
+ this._register(this.storageService.onDidChangeValue(0 , ignoredRecommendationsStorageKey, this._register(( new DisposableStore())))(e => this.onDidStorageChange()));
24
+ this.initIgnoredWorkspaceRecommendations();
25
+ }
26
+ async initIgnoredWorkspaceRecommendations() {
27
+ this.ignoredWorkspaceRecommendations = await this.workspaceExtensionsConfigService.getUnwantedRecommendations();
28
+ this._onDidChangeIgnoredRecommendations.fire();
29
+ this._register(this.workspaceExtensionsConfigService.onDidChangeExtensionsConfigs(async () => {
30
+ this.ignoredWorkspaceRecommendations = await this.workspaceExtensionsConfigService.getUnwantedRecommendations();
31
+ this._onDidChangeIgnoredRecommendations.fire();
32
+ }));
33
+ }
34
+ toggleGlobalIgnoredRecommendation(extensionId, shouldIgnore) {
35
+ extensionId = extensionId.toLowerCase();
36
+ const ignored = this._globalIgnoredRecommendations.indexOf(extensionId) !== -1;
37
+ if (ignored === shouldIgnore) {
38
+ return;
39
+ }
40
+ this._globalIgnoredRecommendations = shouldIgnore ? [...this._globalIgnoredRecommendations, extensionId] : this._globalIgnoredRecommendations.filter(id => id !== extensionId);
41
+ this.storeCachedIgnoredRecommendations(this._globalIgnoredRecommendations);
42
+ this._onDidChangeGlobalIgnoredRecommendation.fire({ extensionId, isRecommended: !shouldIgnore });
43
+ this._onDidChangeIgnoredRecommendations.fire();
44
+ }
45
+ getCachedIgnoredRecommendations() {
46
+ const ignoredRecommendations = JSON.parse(this.ignoredRecommendationsValue);
47
+ return ( ignoredRecommendations.map(e => e.toLowerCase()));
48
+ }
49
+ onDidStorageChange() {
50
+ if (this.ignoredRecommendationsValue !== this.getStoredIgnoredRecommendationsValue() ) {
51
+ this._ignoredRecommendationsValue = undefined;
52
+ this._globalIgnoredRecommendations = this.getCachedIgnoredRecommendations();
53
+ this._onDidChangeIgnoredRecommendations.fire();
54
+ }
55
+ }
56
+ storeCachedIgnoredRecommendations(ignoredRecommendations) {
57
+ this.ignoredRecommendationsValue = JSON.stringify(ignoredRecommendations);
58
+ }
59
+ get ignoredRecommendationsValue() {
60
+ if (!this._ignoredRecommendationsValue) {
61
+ this._ignoredRecommendationsValue = this.getStoredIgnoredRecommendationsValue();
62
+ }
63
+ return this._ignoredRecommendationsValue;
64
+ }
65
+ set ignoredRecommendationsValue(ignoredRecommendationsValue) {
66
+ if (this.ignoredRecommendationsValue !== ignoredRecommendationsValue) {
67
+ this._ignoredRecommendationsValue = ignoredRecommendationsValue;
68
+ this.setStoredIgnoredRecommendationsValue(ignoredRecommendationsValue);
69
+ }
70
+ }
71
+ getStoredIgnoredRecommendationsValue() {
72
+ return this.storageService.get(ignoredRecommendationsStorageKey, 0 , '[]');
73
+ }
74
+ setStoredIgnoredRecommendationsValue(value) {
75
+ this.storageService.store(ignoredRecommendationsStorageKey, value, 0 , 0 );
76
+ }
77
+ };
78
+ ExtensionIgnoredRecommendationsService = ( __decorate([
79
+ ( __param(0, IWorkspaceExtensionsConfigService)),
80
+ ( __param(1, IStorageService))
81
+ ], ExtensionIgnoredRecommendationsService));
82
+
83
+ export { ExtensionIgnoredRecommendationsService };
@@ -0,0 +1,73 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService';
3
+ import { RemoteExtensionsScannerChannelName } from 'vscode/vscode/vs/platform/remote/common/remoteExtensionsScanner';
4
+ import * as platform from 'monaco-editor/esm/vs/base/common/platform.js';
5
+ import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
6
+ import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
7
+ import { IRemoteUserDataProfilesService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/remoteUserDataProfiles';
8
+ import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
9
+ import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
10
+ import { IActiveLanguagePackService } from 'vscode/vscode/vs/workbench/services/localization/common/locale';
11
+
12
+ let RemoteExtensionsScannerService = class RemoteExtensionsScannerService {
13
+ constructor(remoteAgentService, environmentService, userDataProfileService, remoteUserDataProfilesService, logService, activeLanguagePackService) {
14
+ this.remoteAgentService = remoteAgentService;
15
+ this.environmentService = environmentService;
16
+ this.userDataProfileService = userDataProfileService;
17
+ this.remoteUserDataProfilesService = remoteUserDataProfilesService;
18
+ this.logService = logService;
19
+ this.activeLanguagePackService = activeLanguagePackService;
20
+ }
21
+ whenExtensionsReady() {
22
+ return this.withChannel(channel => channel.call('whenExtensionsReady'), undefined);
23
+ }
24
+ async scanExtensions() {
25
+ try {
26
+ const languagePack = await this.activeLanguagePackService.getExtensionIdProvidingCurrentLocale();
27
+ return await this.withChannel(async (channel) => {
28
+ const profileLocation = this.userDataProfileService.currentProfile.isDefault ? undefined : (await this.remoteUserDataProfilesService.getRemoteProfile(this.userDataProfileService.currentProfile)).extensionsResource;
29
+ const scannedExtensions = await channel.call('scanExtensions', [platform.language, profileLocation, this.environmentService.extensionDevelopmentLocationURI, languagePack]);
30
+ scannedExtensions.forEach((extension) => {
31
+ extension.extensionLocation = URI.revive(extension.extensionLocation);
32
+ });
33
+ return scannedExtensions;
34
+ }, []);
35
+ }
36
+ catch (error) {
37
+ this.logService.error(error);
38
+ return [];
39
+ }
40
+ }
41
+ async scanSingleExtension(extensionLocation, isBuiltin) {
42
+ try {
43
+ return await this.withChannel(async (channel) => {
44
+ const extension = await channel.call('scanSingleExtension', [extensionLocation, isBuiltin, platform.language]);
45
+ if (extension !== null) {
46
+ extension.extensionLocation = URI.revive(extension.extensionLocation);
47
+ }
48
+ return extension;
49
+ }, null);
50
+ }
51
+ catch (error) {
52
+ this.logService.error(error);
53
+ return null;
54
+ }
55
+ }
56
+ withChannel(callback, fallback) {
57
+ const connection = this.remoteAgentService.getConnection();
58
+ if (!connection) {
59
+ return Promise.resolve(fallback);
60
+ }
61
+ return connection.withChannel(RemoteExtensionsScannerChannelName, (channel) => callback(channel));
62
+ }
63
+ };
64
+ RemoteExtensionsScannerService = ( __decorate([
65
+ ( __param(0, IRemoteAgentService)),
66
+ ( __param(1, IWorkbenchEnvironmentService)),
67
+ ( __param(2, IUserDataProfileService)),
68
+ ( __param(3, IRemoteUserDataProfilesService)),
69
+ ( __param(4, ILogService)),
70
+ ( __param(5, IActiveLanguagePackService))
71
+ ], RemoteExtensionsScannerService));
72
+
73
+ export { RemoteExtensionsScannerService };