@codingame/monaco-vscode-extension-gallery-service-override 1.85.1 → 1.85.3

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.
@@ -2,7 +2,7 @@ import { __decorate, __param } from './external/tslib/tslib.es6.js';
2
2
  import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
3
3
  import { IExtensionGalleryService, IGlobalExtensionEnablementService, IExtensionManagementService, IExtensionTipsService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
4
4
  import { ExtensionGalleryService } from './vscode/src/vs/platform/extensionManagement/common/extensionGalleryService.js';
5
- import { GlobalExtensionEnablementService } from './vscode/src/vs/platform/extensionManagement/common/extensionEnablementService.js';
5
+ import { GlobalExtensionEnablementService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionEnablementService';
6
6
  import { IExtensionsWorkbenchService } from 'vscode/vscode/vs/workbench/contrib/extensions/common/extensions';
7
7
  import { ExtensionsWorkbenchService } from './vscode/src/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.js';
8
8
  import { IExtensionManagementServerService, IWebExtensionsScannerService, IWorkbenchExtensionEnablementService } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionManagement';
@@ -17,8 +17,6 @@ import { IBuiltinExtensionsScannerService } from 'monaco-editor/esm/vs/platform/
17
17
  import { BuiltinExtensionsScannerService } from './vscode/src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.js';
18
18
  import { ExtensionIgnoredRecommendationsService } from './vscode/src/vs/workbench/services/extensionRecommendations/common/extensionIgnoredRecommendationsService.js';
19
19
  import { IWorkspaceExtensionsConfigService, WorkspaceExtensionsConfigService } from 'vscode/vscode/vs/workbench/services/extensionRecommendations/common/workspaceExtensionsConfig';
20
- import { IRemoteExtensionsScannerService } from 'vscode/vscode/vs/platform/remote/common/remoteExtensionsScanner';
21
- import { RemoteExtensionsScannerService } from './vscode/src/vs/workbench/services/remote/common/remoteExtensionsScanner.js';
22
20
  import { ExtensionRecommendationNotificationService } from './vscode/src/vs/workbench/contrib/extensions/browser/extensionRecommendationNotificationService.js';
23
21
  import { ExtensionTipsService } from './vscode/src/vs/platform/extensionManagement/common/extensionTipsService.js';
24
22
  import { ExtensionManagementService } from './vscode/src/vs/workbench/services/extensionManagement/common/extensionManagementService.js';
@@ -67,7 +65,6 @@ function getServiceOverride(options = { webOnly: false }) {
67
65
  [( IExtensionManagementService.toString())]: new SyncDescriptor(ExtensionManagementService, [], true),
68
66
  [( IBuiltinExtensionsScannerService.toString())]: new SyncDescriptor(BuiltinExtensionsScannerService, [], true),
69
67
  [( IWorkspaceExtensionsConfigService.toString())]: new SyncDescriptor(WorkspaceExtensionsConfigService, [], true),
70
- [( IRemoteExtensionsScannerService.toString())]: new SyncDescriptor(RemoteExtensionsScannerService, [], true),
71
68
  [( IExtensionTipsService.toString())]: new SyncDescriptor(ExtensionTipsService, [], true),
72
69
  [( IRemoteUserDataProfilesService.toString())]: new SyncDescriptor(RemoteUserDataProfilesService, [], true),
73
70
  [( IWorkbenchExtensionEnablementService.toString())]: new SyncDescriptor(ExtensionEnablementService, [], true),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-extension-gallery-service-override",
3
- "version": "1.85.1",
3
+ "version": "1.85.3",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -18,7 +18,7 @@
18
18
  "module": "index.js",
19
19
  "types": "index.d.ts",
20
20
  "dependencies": {
21
- "vscode": "npm:@codingame/monaco-vscode-api@1.85.1",
21
+ "vscode": "npm:@codingame/monaco-vscode-api@1.85.3",
22
22
  "monaco-editor": "0.45.0",
23
23
  "vscode-semver": "npm:semver@=5.5.0"
24
24
  }
@@ -10,7 +10,7 @@ import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/st
10
10
  import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
11
11
  import { isLanguagePackExtension, isAuthenticationProviderExtension, isResolverExtension } from 'monaco-editor/esm/vs/platform/extensions/common/extensions.js';
12
12
  import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
13
- import { StorageManager } from '../../../../platform/extensionManagement/common/extensionEnablementService.js';
13
+ import { StorageManager } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionEnablementService';
14
14
  import { webWorkerExtHostConfig } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
15
15
  import { IUserDataSyncAccountService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSyncAccount';
16
16
  import { IUserDataSyncEnablementService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync';
@@ -1,142 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
- import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
3
- import { Disposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
4
- import { isUndefinedOrNull } from 'monaco-editor/esm/vs/base/common/types.js';
5
- import { DISABLED_EXTENSIONS_STORAGE_PATH, IExtensionManagementService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement';
6
- import { areSameExtensions } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
7
- import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
8
-
9
- let GlobalExtensionEnablementService = class GlobalExtensionEnablementService extends Disposable {
10
- constructor(storageService, extensionManagementService) {
11
- super();
12
- this._onDidChangeEnablement = ( new Emitter());
13
- this.onDidChangeEnablement = this._onDidChangeEnablement.event;
14
- this.storageManger = this._register(( new StorageManager(storageService)));
15
- this._register(this.storageManger.onDidChange(extensions => this._onDidChangeEnablement.fire({ extensions, source: 'storage' })));
16
- this._register(extensionManagementService.onDidInstallExtensions(e => e.forEach(({ local, operation }) => {
17
- if (local && operation === 4 ) {
18
- this._removeFromDisabledExtensions(local.identifier);
19
- }
20
- })));
21
- }
22
- async enableExtension(extension, source) {
23
- if (this._removeFromDisabledExtensions(extension)) {
24
- this._onDidChangeEnablement.fire({ extensions: [extension], source });
25
- return true;
26
- }
27
- return false;
28
- }
29
- async disableExtension(extension, source) {
30
- if (this._addToDisabledExtensions(extension)) {
31
- this._onDidChangeEnablement.fire({ extensions: [extension], source });
32
- return true;
33
- }
34
- return false;
35
- }
36
- getDisabledExtensions() {
37
- return this._getExtensions(DISABLED_EXTENSIONS_STORAGE_PATH);
38
- }
39
- async getDisabledExtensionsAsync() {
40
- return this.getDisabledExtensions();
41
- }
42
- _addToDisabledExtensions(identifier) {
43
- const disabledExtensions = this.getDisabledExtensions();
44
- if (disabledExtensions.every(e => !areSameExtensions(e, identifier))) {
45
- disabledExtensions.push(identifier);
46
- this._setDisabledExtensions(disabledExtensions);
47
- return true;
48
- }
49
- return false;
50
- }
51
- _removeFromDisabledExtensions(identifier) {
52
- const disabledExtensions = this.getDisabledExtensions();
53
- for (let index = 0; index < disabledExtensions.length; index++) {
54
- const disabledExtension = disabledExtensions[index];
55
- if (areSameExtensions(disabledExtension, identifier)) {
56
- disabledExtensions.splice(index, 1);
57
- this._setDisabledExtensions(disabledExtensions);
58
- return true;
59
- }
60
- }
61
- return false;
62
- }
63
- _setDisabledExtensions(disabledExtensions) {
64
- this._setExtensions(DISABLED_EXTENSIONS_STORAGE_PATH, disabledExtensions);
65
- }
66
- _getExtensions(storageId) {
67
- return this.storageManger.get(storageId, 0 );
68
- }
69
- _setExtensions(storageId, extensions) {
70
- this.storageManger.set(storageId, extensions, 0 );
71
- }
72
- };
73
- GlobalExtensionEnablementService = ( __decorate([
74
- ( __param(0, IStorageService)),
75
- ( __param(1, IExtensionManagementService))
76
- ], GlobalExtensionEnablementService));
77
- class StorageManager extends Disposable {
78
- constructor(storageService) {
79
- super();
80
- this.storageService = storageService;
81
- this.storage = Object.create(null);
82
- this._onDidChange = this._register(( new Emitter()));
83
- this.onDidChange = this._onDidChange.event;
84
- this._register(storageService.onDidChangeValue(0 , undefined, this._register(( new DisposableStore())))(e => this.onDidStorageChange(e)));
85
- }
86
- get(key, scope) {
87
- let value;
88
- if (scope === 0 ) {
89
- if (isUndefinedOrNull(this.storage[key])) {
90
- this.storage[key] = this._get(key, scope);
91
- }
92
- value = this.storage[key];
93
- }
94
- else {
95
- value = this._get(key, scope);
96
- }
97
- return JSON.parse(value);
98
- }
99
- set(key, value, scope) {
100
- const newValue = JSON.stringify(( value.map(({ id, uuid }) => ({ id, uuid }))));
101
- const oldValue = this._get(key, scope);
102
- if (oldValue !== newValue) {
103
- if (scope === 0 ) {
104
- if (value.length) {
105
- this.storage[key] = newValue;
106
- }
107
- else {
108
- delete this.storage[key];
109
- }
110
- }
111
- this._set(key, value.length ? newValue : undefined, scope);
112
- }
113
- }
114
- onDidStorageChange(storageChangeEvent) {
115
- if (!isUndefinedOrNull(this.storage[storageChangeEvent.key])) {
116
- const newValue = this._get(storageChangeEvent.key, storageChangeEvent.scope);
117
- if (newValue !== this.storage[storageChangeEvent.key]) {
118
- const oldValues = this.get(storageChangeEvent.key, storageChangeEvent.scope);
119
- delete this.storage[storageChangeEvent.key];
120
- const newValues = this.get(storageChangeEvent.key, storageChangeEvent.scope);
121
- const added = oldValues.filter(oldValue => !( newValues.some(newValue => areSameExtensions(oldValue, newValue))));
122
- const removed = newValues.filter(newValue => !( oldValues.some(oldValue => areSameExtensions(oldValue, newValue))));
123
- if (added.length || removed.length) {
124
- this._onDidChange.fire([...added, ...removed]);
125
- }
126
- }
127
- }
128
- }
129
- _get(key, scope) {
130
- return this.storageService.get(key, scope, '[]');
131
- }
132
- _set(key, value, scope) {
133
- if (value) {
134
- this.storageService.store(key, value, scope, 1 );
135
- }
136
- else {
137
- this.storageService.remove(key, scope);
138
- }
139
- }
140
- }
141
-
142
- export { GlobalExtensionEnablementService, StorageManager };
@@ -1,73 +0,0 @@
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 };