@codingame/monaco-vscode-user-data-profile-service-override 25.1.2 → 26.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/platform/userDataProfile/browser/userDataProfile.js +18 -15
  3. package/vscode/src/vs/platform/userDataProfile/common/userDataProfileStorageService.js +31 -19
  4. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/media/userDataProfilesEditor.css +9 -4
  5. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.js +144 -115
  6. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfileActions.js +16 -10
  7. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor.js +889 -623
  8. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel.js +449 -296
  9. package/vscode/src/vs/workbench/services/userData/browser/userDataInit.js +6 -8
  10. package/vscode/src/vs/workbench/services/userDataProfile/browser/extensionsResource.js +135 -77
  11. package/vscode/src/vs/workbench/services/userDataProfile/browser/globalStateResource.js +33 -32
  12. package/vscode/src/vs/workbench/services/userDataProfile/browser/keybindingsResource.js +33 -34
  13. package/vscode/src/vs/workbench/services/userDataProfile/browser/mcpProfileResource.js +28 -33
  14. package/vscode/src/vs/workbench/services/userDataProfile/browser/settingsResource.js +42 -40
  15. package/vscode/src/vs/workbench/services/userDataProfile/browser/snippetsResource.js +23 -28
  16. package/vscode/src/vs/workbench/services/userDataProfile/browser/tasksResource.js +28 -33
  17. package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.js +209 -153
  18. package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileInit.js +28 -25
  19. package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.js +55 -41
  20. package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileStorageService.js +20 -9
  21. package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncInit.js +111 -73
  22. package/vscode/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.js +20 -15
  23. package/vscode/src/vs/base/browser/ui/radio/radio.css +0 -69
  24. package/vscode/src/vs/base/browser/ui/radio/radio.d.ts +0 -37
  25. package/vscode/src/vs/base/browser/ui/radio/radio.js +0 -72
@@ -23,7 +23,15 @@ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
23
23
  import { ProfileResourceType } from '@codingame/monaco-vscode-api/vscode/vs/platform/userDataProfile/common/userDataProfile';
24
24
 
25
25
  let UserDataProfileInitializer = class UserDataProfileInitializer {
26
- constructor(environmentService, fileService, userDataProfileService, storageService, logService, uriIdentityService, requestService) {
26
+ constructor(
27
+ environmentService,
28
+ fileService,
29
+ userDataProfileService,
30
+ storageService,
31
+ logService,
32
+ uriIdentityService,
33
+ requestService
34
+ ) {
27
35
  this.environmentService = environmentService;
28
36
  this.fileService = fileService;
29
37
  this.userDataProfileService = userDataProfileService;
@@ -77,8 +85,7 @@ let UserDataProfileInitializer = class UserDataProfileInitializer {
77
85
  }
78
86
  promises.push(this.initializeInstalledExtensions(instantiationService));
79
87
  await Promises.settled(promises);
80
- }
81
- finally {
88
+ } finally {
82
89
  this.initializationFinished.open();
83
90
  }
84
91
  }
@@ -86,9 +93,12 @@ let UserDataProfileInitializer = class UserDataProfileInitializer {
86
93
  if (!this.initializeInstalledExtensionsPromise) {
87
94
  const profileTemplate = await this.getProfileTemplate();
88
95
  if (profileTemplate?.extensions) {
89
- this.initializeInstalledExtensionsPromise = this.initialize(instantiationService.createInstance(ExtensionsResourceInitializer), profileTemplate.extensions, ProfileResourceType.Extensions);
90
- }
91
- else {
96
+ this.initializeInstalledExtensionsPromise = this.initialize(
97
+ instantiationService.createInstance(ExtensionsResourceInitializer),
98
+ profileTemplate.extensions,
99
+ ProfileResourceType.Extensions
100
+ );
101
+ } else {
92
102
  this.initializeInstalledExtensionsPromise = Promise.resolve();
93
103
  }
94
104
  }
@@ -107,23 +117,25 @@ let UserDataProfileInitializer = class UserDataProfileInitializer {
107
117
  if (isString(this.environmentService.options.profile.contents)) {
108
118
  try {
109
119
  return JSON.parse(this.environmentService.options.profile.contents);
110
- }
111
- catch (error) {
120
+ } catch (error) {
112
121
  this.logService.error(error);
113
122
  return null;
114
123
  }
115
124
  }
116
125
  try {
117
126
  const url = ( URI.revive(this.environmentService.options.profile.contents).toString(true));
118
- const context = await this.requestService.request({ type: 'GET', url }, CancellationToken.None);
127
+ const context = await this.requestService.request({
128
+ type: "GET",
129
+ url
130
+ }, CancellationToken.None);
119
131
  if (context.res.statusCode === 200) {
120
132
  return await asJson(context);
133
+ } else {
134
+ this.logService.warn(
135
+ `UserDataProfileInitializer: Failed to get profile from URL: ${url}. Status code: ${context.res.statusCode}.`
136
+ );
121
137
  }
122
- else {
123
- this.logService.warn(`UserDataProfileInitializer: Failed to get profile from URL: ${url}. Status code: ${context.res.statusCode}.`);
124
- }
125
- }
126
- catch (error) {
138
+ } catch (error) {
127
139
  this.logService.error(error);
128
140
  }
129
141
  return null;
@@ -138,21 +150,12 @@ let UserDataProfileInitializer = class UserDataProfileInitializer {
138
150
  this.logService.trace(`UserDataProfileInitializer: Initializing ${profileResource}`);
139
151
  await initializer.initialize(content);
140
152
  this.logService.info(`UserDataProfileInitializer: Initialized ${profileResource}`);
141
- }
142
- catch (error) {
153
+ } catch (error) {
143
154
  this.logService.info(`UserDataProfileInitializer: Error while initializing ${profileResource}`);
144
155
  this.logService.error(error);
145
156
  }
146
157
  }
147
158
  };
148
- UserDataProfileInitializer = ( __decorate([
149
- ( __param(0, IBrowserWorkbenchEnvironmentService)),
150
- ( __param(1, IFileService)),
151
- ( __param(2, IUserDataProfileService)),
152
- ( __param(3, IStorageService)),
153
- ( __param(4, ILogService)),
154
- ( __param(5, IUriIdentityService)),
155
- ( __param(6, IRequestService))
156
- ], UserDataProfileInitializer));
159
+ UserDataProfileInitializer = ( __decorate([( __param(0, IBrowserWorkbenchEnvironmentService)), ( __param(1, IFileService)), ( __param(2, IUserDataProfileService)), ( __param(3, IStorageService)), ( __param(4, ILogService)), ( __param(5, IUriIdentityService)), ( __param(6, IRequestService))], UserDataProfileInitializer));
157
160
 
158
161
  export { UserDataProfileInitializer };
@@ -23,7 +23,20 @@ import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/s
23
23
  import { IUserDataProfileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
24
24
 
25
25
  let UserDataProfileManagementService = class UserDataProfileManagementService extends Disposable {
26
- constructor(userDataProfilesService, userDataProfileService, hostService, dialogService, workspaceContextService, extensionService, environmentService, productService, requestService, configurationService, uriIdentityService, logService) {
26
+ constructor(
27
+ userDataProfilesService,
28
+ userDataProfileService,
29
+ hostService,
30
+ dialogService,
31
+ workspaceContextService,
32
+ extensionService,
33
+ environmentService,
34
+ productService,
35
+ requestService,
36
+ configurationService,
37
+ uriIdentityService,
38
+ logService
39
+ ) {
27
40
  super();
28
41
  this.userDataProfilesService = userDataProfilesService;
29
42
  this.userDataProfileService = userDataProfileService;
@@ -37,13 +50,15 @@ let UserDataProfileManagementService = class UserDataProfileManagementService ex
37
50
  this.configurationService = configurationService;
38
51
  this.uriIdentityService = uriIdentityService;
39
52
  this.logService = logService;
40
- this._register(userDataProfileService.onDidChangeCurrentProfile(e => this.onDidChangeCurrentProfile(e)));
53
+ this._register(
54
+ userDataProfileService.onDidChangeCurrentProfile(e => this.onDidChangeCurrentProfile(e))
55
+ );
41
56
  this._register(userDataProfilesService.onDidChangeProfiles(e => {
42
57
  if (( e.removed.some(profile => profile.id === this.userDataProfileService.currentProfile.id))) {
43
58
  const profileToUse = this.getProfileToUseForCurrentWorkspace();
44
59
  this.switchProfile(profileToUse);
45
60
  this.changeCurrentProfile(profileToUse, ( localize(
46
- 14557,
61
+ 14954,
47
62
  "The current profile has been removed. Please reload to switch back to default profile"
48
63
  )));
49
64
  return;
@@ -54,13 +69,12 @@ let UserDataProfileManagementService = class UserDataProfileManagementService ex
54
69
  if (profileToUse?.id !== updatedCurrentProfile.id) {
55
70
  this.switchProfile(profileToUse);
56
71
  this.changeCurrentProfile(profileToUse, ( localize(
57
- 14558,
72
+ 14955,
58
73
  "The current workspace has been removed from the current profile. Please reload to switch back to the updated profile"
59
74
  )));
60
- }
61
- else {
75
+ } else {
62
76
  this.changeCurrentProfile(updatedCurrentProfile, ( localize(
63
- 14559,
77
+ 14956,
64
78
  "The current profile has been updated. Please reload to switch back to the updated profile"
65
79
  )));
66
80
  }
@@ -79,12 +93,13 @@ let UserDataProfileManagementService = class UserDataProfileManagementService ex
79
93
  getProfileToUseForCurrentWorkspace() {
80
94
  const workspaceUri = this.getWorkspaceUri();
81
95
  if (workspaceUri) {
82
- const profileForWorkspace = this.userDataProfilesService.profiles.find(profile => profile.workspaces?.some(ws => this.uriIdentityService.extUri.isEqual(ws, workspaceUri)));
96
+ const profileForWorkspace = this.userDataProfilesService.profiles.find(
97
+ profile => profile.workspaces?.some(ws => this.uriIdentityService.extUri.isEqual(ws, workspaceUri))
98
+ );
83
99
  if (profileForWorkspace) {
84
100
  return profileForWorkspace;
85
101
  }
86
- }
87
- else {
102
+ } else {
88
103
  const currentProfile = this.userDataProfilesService.profiles.find(profile => profile.id === this.userDataProfileService.currentProfile.id);
89
104
  if (currentProfile) {
90
105
  return currentProfile;
@@ -106,7 +121,11 @@ let UserDataProfileManagementService = class UserDataProfileManagementService ex
106
121
  return this.userDataProfilesService.createNamedProfile(name, options);
107
122
  }
108
123
  async createAndEnterProfile(name, options) {
109
- const profile = await this.userDataProfilesService.createNamedProfile(name, options, toWorkspaceIdentifier(this.workspaceContextService.getWorkspace()));
124
+ const profile = await this.userDataProfilesService.createNamedProfile(
125
+ name,
126
+ options,
127
+ toWorkspaceIdentifier(this.workspaceContextService.getWorkspace())
128
+ );
110
129
  await this.changeCurrentProfile(profile);
111
130
  return profile;
112
131
  }
@@ -120,7 +139,7 @@ let UserDataProfileManagementService = class UserDataProfileManagementService ex
120
139
  throw ( new Error(`Profile ${profile.name} does not exist`));
121
140
  }
122
141
  if (profile.isDefault) {
123
- throw ( new Error(( localize(14560, "Cannot rename the default profile"))));
142
+ throw ( new Error(( localize(14957, "Cannot rename the default profile"))));
124
143
  }
125
144
  const updatedProfile = await this.userDataProfilesService.updateProfile(profile, updateOptions);
126
145
  return updatedProfile;
@@ -130,7 +149,7 @@ let UserDataProfileManagementService = class UserDataProfileManagementService ex
130
149
  throw ( new Error(`Profile ${profile.name} does not exist`));
131
150
  }
132
151
  if (profile.isDefault) {
133
- throw ( new Error(( localize(14561, "Cannot delete the default profile"))));
152
+ throw ( new Error(( localize(14958, "Cannot delete the default profile"))));
134
153
  }
135
154
  await this.userDataProfilesService.removeProfile(profile);
136
155
  }
@@ -154,15 +173,16 @@ let UserDataProfileManagementService = class UserDataProfileManagementService ex
154
173
  async getBuiltinProfileTemplates() {
155
174
  if (this.productService.profileTemplatesUrl) {
156
175
  try {
157
- const context = await this.requestService.request({ type: 'GET', url: this.productService.profileTemplatesUrl }, CancellationToken.None);
176
+ const context = await this.requestService.request({
177
+ type: "GET",
178
+ url: this.productService.profileTemplatesUrl
179
+ }, CancellationToken.None);
158
180
  if (context.res.statusCode === 200) {
159
181
  return (await asJson(context)) || [];
182
+ } else {
183
+ this.logService.error("Could not get profile templates.", context.res.statusCode);
160
184
  }
161
- else {
162
- this.logService.error('Could not get profile templates.', context.res.statusCode);
163
- }
164
- }
165
- catch (error) {
185
+ } catch (error) {
166
186
  this.logService.error(error);
167
187
  }
168
188
  }
@@ -170,12 +190,18 @@ let UserDataProfileManagementService = class UserDataProfileManagementService ex
170
190
  }
171
191
  async changeCurrentProfile(profile, reloadMessage) {
172
192
  const isRemoteWindow = !!this.environmentService.remoteAuthority;
173
- const shouldRestartExtensionHosts = this.userDataProfileService.currentProfile.id !== profile.id || !equals(this.userDataProfileService.currentProfile.useDefaultFlags, profile.useDefaultFlags);
193
+ const shouldRestartExtensionHosts = this.userDataProfileService.currentProfile.id !== profile.id || !equals(
194
+ this.userDataProfileService.currentProfile.useDefaultFlags,
195
+ profile.useDefaultFlags
196
+ );
174
197
  if (shouldRestartExtensionHosts) {
175
198
  if (!isRemoteWindow) {
176
- if (!(await this.extensionService.stopExtensionHosts(( localize(14562, "Switching to a profile"))))) {
199
+ if (!(await this.extensionService.stopExtensionHosts(( localize(14959, "Switching to a profile"))))) {
177
200
  if (( this.userDataProfilesService.profiles.some(p => p.id === this.userDataProfileService.currentProfile.id))) {
178
- await this.userDataProfilesService.setProfileForWorkspace(toWorkspaceIdentifier(this.workspaceContextService.getWorkspace()), this.userDataProfileService.currentProfile);
201
+ await this.userDataProfilesService.setProfileForWorkspace(
202
+ toWorkspaceIdentifier(this.workspaceContextService.getWorkspace()),
203
+ this.userDataProfileService.currentProfile
204
+ );
179
205
  }
180
206
  throw ( new CancellationError());
181
207
  }
@@ -184,33 +210,21 @@ let UserDataProfileManagementService = class UserDataProfileManagementService ex
184
210
  await this.userDataProfileService.updateCurrentProfile(profile);
185
211
  if (shouldRestartExtensionHosts) {
186
212
  if (isRemoteWindow) {
187
- const { confirmed } = await this.dialogService.confirm({
188
- message: reloadMessage ?? ( localize(14563, "Switching a profile requires reloading VS Code.")),
189
- primaryButton: ( localize(14564, "&&Reload")),
213
+ const {
214
+ confirmed
215
+ } = await this.dialogService.confirm({
216
+ message: reloadMessage ?? ( localize(14960, "Switching a profile requires reloading VS Code.")),
217
+ primaryButton: ( localize(14961, "&&Reload"))
190
218
  });
191
219
  if (confirmed) {
192
220
  await this.hostService.reload();
193
221
  }
194
- }
195
- else {
222
+ } else {
196
223
  await this.extensionService.startExtensionHosts();
197
224
  }
198
225
  }
199
226
  }
200
227
  };
201
- UserDataProfileManagementService = ( __decorate([
202
- ( __param(0, IUserDataProfilesService)),
203
- ( __param(1, IUserDataProfileService)),
204
- ( __param(2, IHostService)),
205
- ( __param(3, IDialogService)),
206
- ( __param(4, IWorkspaceContextService)),
207
- ( __param(5, IExtensionService)),
208
- ( __param(6, IWorkbenchEnvironmentService)),
209
- ( __param(7, IProductService)),
210
- ( __param(8, IRequestService)),
211
- ( __param(9, IConfigurationService)),
212
- ( __param(10, IUriIdentityService)),
213
- ( __param(11, ILogService))
214
- ], UserDataProfileManagementService));
228
+ UserDataProfileManagementService = ( __decorate([( __param(0, IUserDataProfilesService)), ( __param(1, IUserDataProfileService)), ( __param(2, IHostService)), ( __param(3, IDialogService)), ( __param(4, IWorkspaceContextService)), ( __param(5, IExtensionService)), ( __param(6, IWorkbenchEnvironmentService)), ( __param(7, IProductService)), ( __param(8, IRequestService)), ( __param(9, IConfigurationService)), ( __param(10, IUriIdentityService)), ( __param(11, ILogService))], UserDataProfileManagementService));
215
229
 
216
230
  export { UserDataProfileManagementService };
@@ -19,23 +19,34 @@ let UserDataProfileStorageService = class UserDataProfileStorageService extends
19
19
  this._onDidChange = this._register(( new Emitter()));
20
20
  this.onDidChange = this._onDidChange.event;
21
21
  const disposables = this._register(( new DisposableStore()));
22
- this._register(Event.filter(storageService.onDidChangeTarget, e => e.scope === StorageScope.PROFILE, disposables)(() => this.onDidChangeStorageTargetInCurrentProfile()));
23
- this._register(storageService.onDidChangeValue(StorageScope.PROFILE, undefined, disposables)(e => this.onDidChangeStorageValueInCurrentProfile(e)));
22
+ this._register(Event.filter(
23
+ storageService.onDidChangeTarget,
24
+ e => e.scope === StorageScope.PROFILE,
25
+ disposables
26
+ )(() => this.onDidChangeStorageTargetInCurrentProfile()));
27
+ this._register(
28
+ storageService.onDidChangeValue(StorageScope.PROFILE, undefined, disposables)(e => this.onDidChangeStorageValueInCurrentProfile(e))
29
+ );
24
30
  }
25
31
  onDidChangeStorageTargetInCurrentProfile() {
26
- this._onDidChange.fire({ targetChanges: [this.userDataProfileService.currentProfile], valueChanges: [] });
32
+ this._onDidChange.fire({
33
+ targetChanges: [this.userDataProfileService.currentProfile],
34
+ valueChanges: []
35
+ });
27
36
  }
28
37
  onDidChangeStorageValueInCurrentProfile(e) {
29
- this._onDidChange.fire({ targetChanges: [], valueChanges: [{ profile: this.userDataProfileService.currentProfile, changes: [e] }] });
38
+ this._onDidChange.fire({
39
+ targetChanges: [],
40
+ valueChanges: [{
41
+ profile: this.userDataProfileService.currentProfile,
42
+ changes: [e]
43
+ }]
44
+ });
30
45
  }
31
46
  createStorageDatabase(profile) {
32
47
  return isProfileUsingDefaultStorage(profile) ? IndexedDBStorageDatabase.createApplicationStorage(this.logService) : IndexedDBStorageDatabase.createProfileStorage(profile, this.logService);
33
48
  }
34
49
  };
35
- UserDataProfileStorageService = ( __decorate([
36
- ( __param(0, IStorageService)),
37
- ( __param(1, IUserDataProfileService)),
38
- ( __param(2, ILogService))
39
- ], UserDataProfileStorageService));
50
+ UserDataProfileStorageService = ( __decorate([( __param(0, IStorageService)), ( __param(1, IUserDataProfileService)), ( __param(2, ILogService))], UserDataProfileStorageService));
40
51
 
41
52
  export { UserDataProfileStorageService };