@codingame/monaco-vscode-user-data-profile-service-override 9.0.3 → 10.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.
- package/_virtual/semver.js +5 -0
- package/package.json +2 -2
- package/userDataProfile.js +10 -5
- package/vscode/src/vs/platform/userDataProfile/common/userDataProfileStorageService.js +10 -8
- package/vscode/src/vs/platform/userDataSync/common/extensionsMerge.js +1 -1
- package/vscode/src/vs/platform/userDataSync/common/extensionsSync.js +20 -20
- package/vscode/src/vs/platform/userDataSync/common/globalStateSync.js +25 -26
- package/vscode/src/vs/platform/userDataSync/common/keybindingsSync.js +27 -28
- package/vscode/src/vs/platform/userDataSync/common/settingsSync.js +21 -24
- package/vscode/src/vs/platform/userDataSync/common/snippetsSync.js +40 -40
- package/vscode/src/vs/platform/userDataSync/common/tasksSync.js +14 -14
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/media/userDataProfilesEditor.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.contribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.js +26 -24
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfileActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor.js +577 -138
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel.js +242 -103
- package/vscode/src/vs/workbench/services/userData/browser/userDataInit.js +1 -2
- package/vscode/src/vs/workbench/services/userDataProfile/browser/extensionsResource.js +11 -11
- package/vscode/src/vs/workbench/services/userDataProfile/browser/globalStateResource.js +9 -11
- package/vscode/src/vs/workbench/services/userDataProfile/browser/keybindingsResource.js +5 -6
- package/vscode/src/vs/workbench/services/userDataProfile/browser/settingsResource.js +7 -8
- package/vscode/src/vs/workbench/services/userDataProfile/browser/snippetsResource.js +5 -6
- package/vscode/src/vs/workbench/services/userDataProfile/browser/tasksResource.js +5 -6
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.js +44 -46
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileInit.js +7 -9
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.js +75 -34
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileStorageService.js +3 -4
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncInit.js +13 -15
- package/vscode/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.js +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import { StorageScope } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
3
2
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
4
3
|
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
5
4
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
@@ -18,7 +17,6 @@ import { asJson } from 'vscode/vscode/vs/platform/request/common/request';
|
|
|
18
17
|
import { IRequestService } from 'vscode/vscode/vs/platform/request/common/request.service';
|
|
19
18
|
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
20
19
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
21
|
-
import { ProfileResourceType } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile';
|
|
22
20
|
|
|
23
21
|
let UserDataProfileInitializer = class UserDataProfileInitializer {
|
|
24
22
|
constructor(environmentService, fileService, userDataProfileService, storageService, logService, uriIdentityService, requestService) {
|
|
@@ -39,7 +37,7 @@ let UserDataProfileInitializer = class UserDataProfileInitializer {
|
|
|
39
37
|
if (!this.environmentService.options?.profile?.contents) {
|
|
40
38
|
return false;
|
|
41
39
|
}
|
|
42
|
-
if (!this.storageService.isNew(
|
|
40
|
+
if (!this.storageService.isNew(0 )) {
|
|
43
41
|
return false;
|
|
44
42
|
}
|
|
45
43
|
return true;
|
|
@@ -49,10 +47,10 @@ let UserDataProfileInitializer = class UserDataProfileInitializer {
|
|
|
49
47
|
const promises = [];
|
|
50
48
|
const profileTemplate = await this.getProfileTemplate();
|
|
51
49
|
if (profileTemplate?.settings) {
|
|
52
|
-
promises.push(this.initialize(( new SettingsResourceInitializer(this.userDataProfileService, this.fileService, this.logService)), profileTemplate.settings,
|
|
50
|
+
promises.push(this.initialize(( new SettingsResourceInitializer(this.userDataProfileService, this.fileService, this.logService)), profileTemplate.settings, "settings" ));
|
|
53
51
|
}
|
|
54
52
|
if (profileTemplate?.globalState) {
|
|
55
|
-
promises.push(this.initialize(( new GlobalStateResourceInitializer(this.storageService)), profileTemplate.globalState,
|
|
53
|
+
promises.push(this.initialize(( new GlobalStateResourceInitializer(this.storageService)), profileTemplate.globalState, "globalState" ));
|
|
56
54
|
}
|
|
57
55
|
await Promise.all(promises);
|
|
58
56
|
}
|
|
@@ -62,13 +60,13 @@ let UserDataProfileInitializer = class UserDataProfileInitializer {
|
|
|
62
60
|
const promises = [];
|
|
63
61
|
const profileTemplate = await this.getProfileTemplate();
|
|
64
62
|
if (profileTemplate?.keybindings) {
|
|
65
|
-
promises.push(this.initialize(( new KeybindingsResourceInitializer(this.userDataProfileService, this.fileService, this.logService)), profileTemplate.keybindings,
|
|
63
|
+
promises.push(this.initialize(( new KeybindingsResourceInitializer(this.userDataProfileService, this.fileService, this.logService)), profileTemplate.keybindings, "keybindings" ));
|
|
66
64
|
}
|
|
67
65
|
if (profileTemplate?.tasks) {
|
|
68
|
-
promises.push(this.initialize(( new TasksResourceInitializer(this.userDataProfileService, this.fileService, this.logService)), profileTemplate.tasks,
|
|
66
|
+
promises.push(this.initialize(( new TasksResourceInitializer(this.userDataProfileService, this.fileService, this.logService)), profileTemplate.tasks, "tasks" ));
|
|
69
67
|
}
|
|
70
68
|
if (profileTemplate?.snippets) {
|
|
71
|
-
promises.push(this.initialize(( new SnippetsResourceInitializer(this.userDataProfileService, this.fileService, this.uriIdentityService)), profileTemplate.snippets,
|
|
69
|
+
promises.push(this.initialize(( new SnippetsResourceInitializer(this.userDataProfileService, this.fileService, this.uriIdentityService)), profileTemplate.snippets, "snippets" ));
|
|
72
70
|
}
|
|
73
71
|
promises.push(this.initializeInstalledExtensions(instantiationService));
|
|
74
72
|
await Promises.settled(promises);
|
|
@@ -81,7 +79,7 @@ let UserDataProfileInitializer = class UserDataProfileInitializer {
|
|
|
81
79
|
if (!this.initializeInstalledExtensionsPromise) {
|
|
82
80
|
const profileTemplate = await this.getProfileTemplate();
|
|
83
81
|
if (profileTemplate?.extensions) {
|
|
84
|
-
this.initializeInstalledExtensionsPromise = this.initialize(instantiationService.createInstance(ExtensionsResourceInitializer), profileTemplate.extensions,
|
|
82
|
+
this.initializeInstalledExtensionsPromise = this.initialize(instantiationService.createInstance(ExtensionsResourceInitializer), profileTemplate.extensions, "extensions" );
|
|
85
83
|
}
|
|
86
84
|
else {
|
|
87
85
|
this.initializeInstalledExtensionsPromise = Promise.resolve();
|
package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.js
CHANGED
|
@@ -4,23 +4,25 @@ import { CancellationError } from 'vscode/vscode/vs/base/common/errors';
|
|
|
4
4
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
5
|
import { equals } from 'vscode/vscode/vs/base/common/objects';
|
|
6
6
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
7
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
7
8
|
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
8
|
-
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
9
9
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
10
10
|
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
11
11
|
import { asJson } from 'vscode/vscode/vs/platform/request/common/request';
|
|
12
12
|
import { IRequestService } from 'vscode/vscode/vs/platform/request/common/request.service';
|
|
13
13
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
14
|
+
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
14
15
|
import { IUserDataProfilesService } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile.service';
|
|
15
|
-
import { toWorkspaceIdentifier } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
16
|
+
import { toWorkspaceIdentifier, isEmptyWorkspaceIdentifier } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
16
17
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
18
|
+
import { CONFIG_NEW_WINDOW_PROFILE } from 'vscode/vscode/vs/workbench/common/configuration';
|
|
17
19
|
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
18
20
|
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
19
21
|
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
|
|
20
22
|
import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
|
|
21
23
|
|
|
22
24
|
let UserDataProfileManagementService = class UserDataProfileManagementService extends Disposable {
|
|
23
|
-
constructor(userDataProfilesService, userDataProfileService, hostService, dialogService, workspaceContextService, extensionService, environmentService, telemetryService, productService, requestService, logService) {
|
|
25
|
+
constructor(userDataProfilesService, userDataProfileService, hostService, dialogService, workspaceContextService, extensionService, environmentService, telemetryService, productService, requestService, configurationService, uriIdentityService, logService) {
|
|
24
26
|
super();
|
|
25
27
|
this.userDataProfilesService = userDataProfilesService;
|
|
26
28
|
this.userDataProfileService = userDataProfileService;
|
|
@@ -32,42 +34,73 @@ let UserDataProfileManagementService = class UserDataProfileManagementService ex
|
|
|
32
34
|
this.telemetryService = telemetryService;
|
|
33
35
|
this.productService = productService;
|
|
34
36
|
this.requestService = requestService;
|
|
37
|
+
this.configurationService = configurationService;
|
|
38
|
+
this.uriIdentityService = uriIdentityService;
|
|
35
39
|
this.logService = logService;
|
|
36
|
-
this._register(userDataProfilesService.onDidChangeProfiles(e => this.onDidChangeProfiles(e)));
|
|
37
|
-
this._register(userDataProfilesService.onDidResetWorkspaces(() => this.onDidResetWorkspaces()));
|
|
38
40
|
this._register(userDataProfileService.onDidChangeCurrentProfile(e => this.onDidChangeCurrentProfile(e)));
|
|
39
41
|
this._register(userDataProfilesService.onDidChangeProfiles(e => {
|
|
42
|
+
if (( (e.removed.some(profile => profile.id === this.userDataProfileService.currentProfile.id)))) {
|
|
43
|
+
const profileToUse = this.getProfileToUseForCurrentWorkspace();
|
|
44
|
+
this.switchProfile(profileToUse);
|
|
45
|
+
this.changeCurrentProfile(profileToUse, ( localize(
|
|
46
|
+
3722,
|
|
47
|
+
"The current profile has been removed. Please reload to switch back to default profile"
|
|
48
|
+
)));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
40
51
|
const updatedCurrentProfile = e.updated.find(p => this.userDataProfileService.currentProfile.id === p.id);
|
|
41
52
|
if (updatedCurrentProfile) {
|
|
42
|
-
this.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
53
|
+
const profileToUse = this.getProfileToUseForCurrentWorkspace();
|
|
54
|
+
if (profileToUse?.id !== updatedCurrentProfile.id) {
|
|
55
|
+
this.switchProfile(profileToUse);
|
|
56
|
+
this.changeCurrentProfile(profileToUse, ( localize(
|
|
57
|
+
3723,
|
|
58
|
+
"The current workspace has been removed from the current profile. Please reload to switch back to the updated profile"
|
|
59
|
+
)));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
this.changeCurrentProfile(updatedCurrentProfile, ( localize(
|
|
63
|
+
3724,
|
|
64
|
+
"The current profile has been updated. Please reload to switch back to the updated profile"
|
|
65
|
+
)));
|
|
66
|
+
}
|
|
46
67
|
}
|
|
47
68
|
}));
|
|
48
69
|
}
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
this.
|
|
52
|
-
3695,
|
|
53
|
-
"The current profile has been removed. Please reload to switch back to default profile"
|
|
54
|
-
)));
|
|
55
|
-
return;
|
|
70
|
+
async onDidChangeCurrentProfile(e) {
|
|
71
|
+
if (e.previous.isTransient) {
|
|
72
|
+
await this.userDataProfilesService.cleanUpTransientProfiles();
|
|
56
73
|
}
|
|
57
74
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
75
|
+
getWorkspaceUri() {
|
|
76
|
+
const workspace = this.workspaceContextService.getWorkspace();
|
|
77
|
+
return workspace.configuration ?? workspace.folders[0]?.uri;
|
|
78
|
+
}
|
|
79
|
+
getProfileToUseForCurrentWorkspace() {
|
|
80
|
+
const workspaceUri = this.getWorkspaceUri();
|
|
81
|
+
if (workspaceUri) {
|
|
82
|
+
const profileForWorkspace = this.userDataProfilesService.profiles.find(profile => profile.workspaces?.some(ws => this.uriIdentityService.extUri.isEqual(ws, workspaceUri)));
|
|
83
|
+
if (profileForWorkspace) {
|
|
84
|
+
return profileForWorkspace;
|
|
85
|
+
}
|
|
65
86
|
}
|
|
87
|
+
else {
|
|
88
|
+
const currentProfile = this.userDataProfilesService.profiles.find(profile => profile.id === this.userDataProfileService.currentProfile.id);
|
|
89
|
+
if (currentProfile) {
|
|
90
|
+
return currentProfile;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return this.getDefaultProfileToUse();
|
|
66
94
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
95
|
+
getDefaultProfileToUse() {
|
|
96
|
+
const newWindowProfileConfigValue = this.configurationService.getValue(CONFIG_NEW_WINDOW_PROFILE);
|
|
97
|
+
if (newWindowProfileConfigValue) {
|
|
98
|
+
const newWindowProfile = this.userDataProfilesService.profiles.find(profile => profile.name === newWindowProfileConfigValue);
|
|
99
|
+
if (newWindowProfile) {
|
|
100
|
+
return newWindowProfile;
|
|
101
|
+
}
|
|
70
102
|
}
|
|
103
|
+
return this.userDataProfilesService.defaultProfile;
|
|
71
104
|
}
|
|
72
105
|
async createProfile(name, options) {
|
|
73
106
|
return this.userDataProfilesService.createNamedProfile(name, options);
|
|
@@ -89,7 +122,7 @@ let UserDataProfileManagementService = class UserDataProfileManagementService ex
|
|
|
89
122
|
throw ( (new Error(`Profile ${profile.name} does not exist`)));
|
|
90
123
|
}
|
|
91
124
|
if (profile.isDefault) {
|
|
92
|
-
throw ( (new Error(localize(
|
|
125
|
+
throw ( (new Error(localize(3725, "Cannot rename the default profile"))));
|
|
93
126
|
}
|
|
94
127
|
const updatedProfile = await this.userDataProfilesService.updateProfile(profile, updateOptions);
|
|
95
128
|
this.telemetryService.publicLog2('profileManagementActionExecuted', { id: 'updateProfile' });
|
|
@@ -100,22 +133,28 @@ let UserDataProfileManagementService = class UserDataProfileManagementService ex
|
|
|
100
133
|
throw ( (new Error(`Profile ${profile.name} does not exist`)));
|
|
101
134
|
}
|
|
102
135
|
if (profile.isDefault) {
|
|
103
|
-
throw ( (new Error(localize(
|
|
136
|
+
throw ( (new Error(localize(3726, "Cannot delete the default profile"))));
|
|
104
137
|
}
|
|
105
138
|
await this.userDataProfilesService.removeProfile(profile);
|
|
106
139
|
this.telemetryService.publicLog2('profileManagementActionExecuted', { id: 'removeProfile' });
|
|
107
140
|
}
|
|
108
141
|
async switchProfile(profile) {
|
|
109
|
-
const workspaceIdentifier = toWorkspaceIdentifier(this.workspaceContextService.getWorkspace());
|
|
110
142
|
if (!( (this.userDataProfilesService.profiles.some(p => p.id === profile.id)))) {
|
|
111
143
|
throw ( (new Error(`Profile ${profile.name} does not exist`)));
|
|
112
144
|
}
|
|
113
145
|
if (this.userDataProfileService.currentProfile.id === profile.id) {
|
|
114
146
|
return;
|
|
115
147
|
}
|
|
148
|
+
const workspaceUri = this.getWorkspaceUri();
|
|
149
|
+
if (workspaceUri && profile.workspaces?.some(ws => this.uriIdentityService.extUri.isEqual(ws, workspaceUri))) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const workspaceIdentifier = toWorkspaceIdentifier(this.workspaceContextService.getWorkspace());
|
|
116
153
|
await this.userDataProfilesService.setProfileForWorkspace(workspaceIdentifier, profile);
|
|
117
|
-
await this.changeCurrentProfile(profile);
|
|
118
154
|
this.telemetryService.publicLog2('profileManagementActionExecuted', { id: 'switchProfile' });
|
|
155
|
+
if (isEmptyWorkspaceIdentifier(workspaceIdentifier)) {
|
|
156
|
+
await this.changeCurrentProfile(profile);
|
|
157
|
+
}
|
|
119
158
|
}
|
|
120
159
|
async getBuiltinProfileTemplates() {
|
|
121
160
|
if (this.productService.profileTemplatesUrl) {
|
|
@@ -139,7 +178,7 @@ let UserDataProfileManagementService = class UserDataProfileManagementService ex
|
|
|
139
178
|
const shouldRestartExtensionHosts = this.userDataProfileService.currentProfile.id !== profile.id || !equals(this.userDataProfileService.currentProfile.useDefaultFlags, profile.useDefaultFlags);
|
|
140
179
|
if (shouldRestartExtensionHosts) {
|
|
141
180
|
if (!isRemoteWindow) {
|
|
142
|
-
if (!(await this.extensionService.stopExtensionHosts(( localize(
|
|
181
|
+
if (!(await this.extensionService.stopExtensionHosts(( localize(3727, "Switching to a profile."))))) {
|
|
143
182
|
if (( (this.userDataProfilesService.profiles.some(p => p.id === this.userDataProfileService.currentProfile.id)))) {
|
|
144
183
|
await this.userDataProfilesService.setProfileForWorkspace(toWorkspaceIdentifier(this.workspaceContextService.getWorkspace()), this.userDataProfileService.currentProfile);
|
|
145
184
|
}
|
|
@@ -151,8 +190,8 @@ let UserDataProfileManagementService = class UserDataProfileManagementService ex
|
|
|
151
190
|
if (shouldRestartExtensionHosts) {
|
|
152
191
|
if (isRemoteWindow) {
|
|
153
192
|
const { confirmed } = await this.dialogService.confirm({
|
|
154
|
-
message: reloadMessage ?? ( localize(
|
|
155
|
-
primaryButton: ( localize(
|
|
193
|
+
message: reloadMessage ?? ( localize(3728, "Switching a profile requires reloading VS Code.")),
|
|
194
|
+
primaryButton: ( localize(3729, "&&Reload")),
|
|
156
195
|
});
|
|
157
196
|
if (confirmed) {
|
|
158
197
|
await this.hostService.reload();
|
|
@@ -175,7 +214,9 @@ UserDataProfileManagementService = ( (__decorate([
|
|
|
175
214
|
( (__param(7, ITelemetryService))),
|
|
176
215
|
( (__param(8, IProductService))),
|
|
177
216
|
( (__param(9, IRequestService))),
|
|
178
|
-
( (__param(10,
|
|
217
|
+
( (__param(10, IConfigurationService))),
|
|
218
|
+
( (__param(11, IUriIdentityService))),
|
|
219
|
+
( (__param(12, ILogService)))
|
|
179
220
|
], UserDataProfileManagementService)));
|
|
180
221
|
|
|
181
222
|
export { UserDataProfileManagementService };
|
package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileStorageService.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
3
|
-
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
4
3
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
5
4
|
import { AbstractUserDataProfileStorageService } from '../../../../platform/userDataProfile/common/userDataProfileStorageService.js';
|
|
6
5
|
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
7
|
-
import {
|
|
6
|
+
import { isProfileUsingDefaultStorage } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
8
7
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
9
8
|
import { IndexedDBStorageDatabase } from 'vscode/vscode/vs/workbench/services/storage/browser/storageService';
|
|
10
9
|
import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
|
|
@@ -18,8 +17,8 @@ let UserDataProfileStorageService = class UserDataProfileStorageService extends
|
|
|
18
17
|
this._onDidChange = this._register(( new Emitter()));
|
|
19
18
|
this.onDidChange = this._onDidChange.event;
|
|
20
19
|
const disposables = this._register(( new DisposableStore()));
|
|
21
|
-
this._register(Event.filter(storageService.onDidChangeTarget, e => e.scope ===
|
|
22
|
-
this._register(storageService.onDidChangeValue(
|
|
20
|
+
this._register(Event.filter(storageService.onDidChangeTarget, e => e.scope === 0 , disposables)(() => this.onDidChangeStorageTargetInCurrentProfile()));
|
|
21
|
+
this._register(storageService.onDidChangeValue(0 , undefined, disposables)(e => this.onDidChangeStorageValueInCurrentProfile(e)));
|
|
23
22
|
}
|
|
24
23
|
onDidChangeStorageTargetInCurrentProfile() {
|
|
25
24
|
this._onDidChange.fire({ targetChanges: [this.userDataProfileService.currentProfile], valueChanges: [] });
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import { StorageScope } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
3
2
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
4
3
|
import { AbstractExtensionsInitializer } from '../../../../platform/userDataSync/common/extensionsSync.js';
|
|
5
4
|
import { UserDataSyncStoreTypeSynchronizer, GlobalStateInitializer } from '../../../../platform/userDataSync/common/globalStateSync.js';
|
|
@@ -11,7 +10,6 @@ import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
|
11
10
|
import { UserDataSyncStoreClient } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSyncStoreService';
|
|
12
11
|
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
13
12
|
import { IRequestService } from 'vscode/vscode/vs/platform/request/common/request.service';
|
|
14
|
-
import { SyncResource } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync';
|
|
15
13
|
import { IUserDataSyncStoreManagementService, IUserDataSyncLogService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync.service';
|
|
16
14
|
import { getCurrentAuthenticationSessionInfo } from 'vscode/vscode/vs/workbench/services/authentication/browser/authenticationService';
|
|
17
15
|
import { getSyncAreaLabel } from 'vscode/vscode/vs/workbench/services/userDataSync/common/userDataSync';
|
|
@@ -62,11 +60,11 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
62
60
|
this.logService.trace(`Skipping initializing user data in desktop`);
|
|
63
61
|
return;
|
|
64
62
|
}
|
|
65
|
-
if (!this.storageService.isNew(
|
|
63
|
+
if (!this.storageService.isNew(-1 )) {
|
|
66
64
|
this.logService.trace(`Skipping initializing user data as application was opened before`);
|
|
67
65
|
return;
|
|
68
66
|
}
|
|
69
|
-
if (!this.storageService.isNew(
|
|
67
|
+
if (!this.storageService.isNew(1 )) {
|
|
70
68
|
this.logService.trace(`Skipping initializing user data as workspace was opened before`);
|
|
71
69
|
return;
|
|
72
70
|
}
|
|
@@ -135,7 +133,7 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
135
133
|
this.storageService
|
|
136
134
|
)));
|
|
137
135
|
userDataSyncStoreClient.setAuthToken(authenticationSession.accessToken, authenticationSession.providerId);
|
|
138
|
-
this.globalStateUserData = await userDataSyncStoreClient.readResource(
|
|
136
|
+
this.globalStateUserData = await userDataSyncStoreClient.readResource("globalState" , null);
|
|
139
137
|
if (this.globalStateUserData) {
|
|
140
138
|
const userDataSyncStoreType = ( new UserDataSyncStoreTypeSynchronizer(
|
|
141
139
|
userDataSyncStoreClient,
|
|
@@ -167,12 +165,12 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
167
165
|
}
|
|
168
166
|
async initializeRequiredResources() {
|
|
169
167
|
this.logService.trace(`UserDataInitializationService#initializeRequiredResources`);
|
|
170
|
-
return this.initialize([
|
|
168
|
+
return this.initialize(["settings" , "globalState" ]);
|
|
171
169
|
}
|
|
172
170
|
async initializeOtherResources(instantiationService) {
|
|
173
171
|
try {
|
|
174
172
|
this.logService.trace(`UserDataInitializationService#initializeOtherResources`);
|
|
175
|
-
await Promise.allSettled([this.initialize([
|
|
173
|
+
await Promise.allSettled([this.initialize(["keybindings" , "snippets" , "tasks" ]), this.initializeExtensions(instantiationService)]);
|
|
176
174
|
}
|
|
177
175
|
finally {
|
|
178
176
|
this.initializationFinished.open();
|
|
@@ -183,7 +181,7 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
183
181
|
await Promise.all([this.initializeInstalledExtensions(instantiationService), this.initializeNewExtensions(instantiationService)]);
|
|
184
182
|
}
|
|
185
183
|
finally {
|
|
186
|
-
this.initialized.push(
|
|
184
|
+
this.initialized.push("extensions" );
|
|
187
185
|
}
|
|
188
186
|
}
|
|
189
187
|
async initializeInstalledExtensions(instantiationService) {
|
|
@@ -217,7 +215,7 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
217
215
|
if (!userDataSyncStoreClient) {
|
|
218
216
|
return null;
|
|
219
217
|
}
|
|
220
|
-
const userData = await userDataSyncStoreClient.readResource(
|
|
218
|
+
const userData = await userDataSyncStoreClient.readResource("extensions" , null);
|
|
221
219
|
return instantiationService.createInstance(ExtensionsPreviewInitializer, userData);
|
|
222
220
|
})();
|
|
223
221
|
}
|
|
@@ -237,7 +235,7 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
237
235
|
this.initialized.push(syncResource);
|
|
238
236
|
this.logService.trace(`Initializing ${getSyncAreaLabel(syncResource)}`);
|
|
239
237
|
const initializer = this.createSyncResourceInitializer(syncResource);
|
|
240
|
-
const userData = await userDataSyncStoreClient.readResource(syncResource, syncResource ===
|
|
238
|
+
const userData = await userDataSyncStoreClient.readResource(syncResource, syncResource === "globalState" ? this.globalStateUserData : null);
|
|
241
239
|
await initializer.initialize(userData);
|
|
242
240
|
this.logService.info(`Initialized ${getSyncAreaLabel(syncResource)}`);
|
|
243
241
|
}
|
|
@@ -249,7 +247,7 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
249
247
|
}
|
|
250
248
|
createSyncResourceInitializer(syncResource) {
|
|
251
249
|
switch (syncResource) {
|
|
252
|
-
case
|
|
250
|
+
case "settings" : return ( new SettingsInitializer(
|
|
253
251
|
this.fileService,
|
|
254
252
|
this.userDataProfilesService,
|
|
255
253
|
this.environmentService,
|
|
@@ -257,7 +255,7 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
257
255
|
this.storageService,
|
|
258
256
|
this.uriIdentityService
|
|
259
257
|
));
|
|
260
|
-
case
|
|
258
|
+
case "keybindings" : return ( new KeybindingsInitializer(
|
|
261
259
|
this.fileService,
|
|
262
260
|
this.userDataProfilesService,
|
|
263
261
|
this.environmentService,
|
|
@@ -265,7 +263,7 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
265
263
|
this.storageService,
|
|
266
264
|
this.uriIdentityService
|
|
267
265
|
));
|
|
268
|
-
case
|
|
266
|
+
case "tasks" : return ( new TasksInitializer(
|
|
269
267
|
this.fileService,
|
|
270
268
|
this.userDataProfilesService,
|
|
271
269
|
this.environmentService,
|
|
@@ -273,7 +271,7 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
273
271
|
this.storageService,
|
|
274
272
|
this.uriIdentityService
|
|
275
273
|
));
|
|
276
|
-
case
|
|
274
|
+
case "snippets" : return ( new SnippetsInitializer(
|
|
277
275
|
this.fileService,
|
|
278
276
|
this.userDataProfilesService,
|
|
279
277
|
this.environmentService,
|
|
@@ -281,7 +279,7 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
281
279
|
this.storageService,
|
|
282
280
|
this.uriIdentityService
|
|
283
281
|
));
|
|
284
|
-
case
|
|
282
|
+
case "globalState" : return ( new GlobalStateInitializer(
|
|
285
283
|
this.storageService,
|
|
286
284
|
this.fileService,
|
|
287
285
|
this.userDataProfilesService,
|
|
@@ -2,7 +2,6 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
|
2
2
|
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
3
3
|
import { getDefaultIgnoredSettings } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync';
|
|
4
4
|
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
|
-
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
6
5
|
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
7
6
|
import { ITextResourcePropertiesService, ITextResourceConfigurationService } from 'vscode/vscode/vs/editor/common/services/textResourceConfiguration';
|
|
8
7
|
|