@codingame/monaco-vscode-user-data-sync-service-override 4.5.1 → 5.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/package.json +2 -2
- package/vscode/src/vs/platform/userDataSync/common/extensionsSync.js +1 -1
- package/vscode/src/vs/platform/userDataSync/common/globalStateSync.js +2 -2
- package/vscode/src/vs/platform/userDataSync/common/keybindingsSync.js +12 -3
- package/vscode/src/vs/platform/userDataSync/common/settingsSync.js +8 -3
- package/vscode/src/vs/platform/userDataSync/common/snippetsSync.js +1 -1
- package/vscode/src/vs/platform/userDataSync/common/tasksSync.js +1 -1
- package/vscode/src/vs/platform/userDataSync/common/userDataAutoSyncService.js +34 -8
- package/vscode/src/vs/platform/userDataSync/common/userDataProfilesManifestSync.js +19 -19
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncLog.js +6 -9
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncResourceProvider.js +6 -1
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncService.js +5 -2
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSync.contribution.js +20 -45
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSync.js +352 -512
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncConflictsView.js +46 -65
- package/vscode/src/vs/workbench/contrib/userDataSync/browser/userDataSyncViews.js +211 -287
- package/vscode/src/vs/workbench/services/userDataProfile/browser/extensionsResource.js +70 -85
- package/vscode/src/vs/workbench/services/userDataProfile/browser/globalStateResource.js +25 -28
- package/vscode/src/vs/workbench/services/userDataProfile/browser/keybindingsResource.js +19 -20
- package/vscode/src/vs/workbench/services/userDataProfile/browser/settingsResource.js +22 -23
- package/vscode/src/vs/workbench/services/userDataProfile/browser/snippetsResource.js +51 -52
- package/vscode/src/vs/workbench/services/userDataProfile/browser/tasksResource.js +19 -20
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.js +214 -519
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.js +34 -45
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncInit.js +2 -2
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncWorkbenchService.js +92 -169
- package/vscode/src/vs/base/browser/ui/icons/iconSelectBox.css.js +0 -6
- package/vscode/src/vs/base/browser/ui/icons/iconSelectBox.js +0 -248
- package/vscode/src/vs/workbench/services/userDataProfile/browser/iconSelectBox.js +0 -99
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-user-data-sync-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@5.0.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -160,7 +160,7 @@ let ExtensionsSynchroniser = class ExtensionsSynchroniser extends AbstractSynchr
|
|
|
160
160
|
if (this.extUri.isEqual(resource, this.previewResource)) {
|
|
161
161
|
return resourcePreview.previewResult;
|
|
162
162
|
}
|
|
163
|
-
throw new Error(`Invalid Resource: ${resource.toString()}`);
|
|
163
|
+
throw ( new Error(`Invalid Resource: ${( resource.toString())}`));
|
|
164
164
|
}
|
|
165
165
|
async acceptLocal(resourcePreview) {
|
|
166
166
|
const installedExtensions = await this.extensionManagementService.getInstalled(undefined, this.syncResource.profile.extensionsResource);
|
|
@@ -118,7 +118,7 @@ let GlobalStateSynchroniser = class GlobalStateSynchroniser extends AbstractSync
|
|
|
118
118
|
if (this.extUri.isEqual(resource, this.previewResource)) {
|
|
119
119
|
return resourcePreview.previewResult;
|
|
120
120
|
}
|
|
121
|
-
throw new Error(`Invalid Resource: ${resource.toString()}`);
|
|
121
|
+
throw ( new Error(`Invalid Resource: ${( resource.toString())}`));
|
|
122
122
|
}
|
|
123
123
|
async acceptLocal(resourcePreview) {
|
|
124
124
|
return {
|
|
@@ -418,7 +418,7 @@ let UserDataSyncStoreTypeSynchronizer = class UserDataSyncStoreTypeSynchronizer
|
|
|
418
418
|
if (isSyncData(syncData)) {
|
|
419
419
|
return syncData ? JSON.parse(syncData.content) : null;
|
|
420
420
|
}
|
|
421
|
-
throw new Error('Invalid remote data');
|
|
421
|
+
throw ( new Error('Invalid remote data'));
|
|
422
422
|
}
|
|
423
423
|
};
|
|
424
424
|
UserDataSyncStoreTypeSynchronizer = ( __decorate([
|
|
@@ -18,6 +18,7 @@ import { merge } from './keybindingsMerge.js';
|
|
|
18
18
|
import { USER_DATA_SYNC_SCHEME, UserDataSyncError, CONFIG_SYNC_KEYBINDINGS_PER_PLATFORM } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync';
|
|
19
19
|
import { IUserDataSyncStoreService, IUserDataSyncLocalStoreService, IUserDataSyncLogService, IUserDataSyncEnablementService, IUserDataSyncUtilService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync.service';
|
|
20
20
|
|
|
21
|
+
const _moduleId = "vs/platform/userDataSync/common/keybindingsSync";
|
|
21
22
|
function getKeybindingsContentFromSyncContent(syncContent, platformSpecific, logService) {
|
|
22
23
|
try {
|
|
23
24
|
const parsed = JSON.parse(syncContent);
|
|
@@ -63,7 +64,11 @@ let KeybindingsSynchroniser = class KeybindingsSynchroniser extends AbstractJson
|
|
|
63
64
|
let localContent = fileContent ? ( fileContent.value.toString()) : '[]';
|
|
64
65
|
localContent = localContent || '[]';
|
|
65
66
|
if (this.hasErrors(localContent, true)) {
|
|
66
|
-
throw new UserDataSyncError(localizeWithPath(
|
|
67
|
+
throw ( new UserDataSyncError(localizeWithPath(
|
|
68
|
+
_moduleId,
|
|
69
|
+
0,
|
|
70
|
+
"Unable to sync keybindings because the content in the file is not valid. Please open the file and correct it."
|
|
71
|
+
), "LocalInvalidContent" , this.resource));
|
|
67
72
|
}
|
|
68
73
|
if (!lastSyncContent
|
|
69
74
|
|| lastSyncContent !== localContent
|
|
@@ -151,7 +156,7 @@ let KeybindingsSynchroniser = class KeybindingsSynchroniser extends AbstractJson
|
|
|
151
156
|
};
|
|
152
157
|
}
|
|
153
158
|
}
|
|
154
|
-
throw new Error(`Invalid Resource: ${resource.toString()}`);
|
|
159
|
+
throw ( new Error(`Invalid Resource: ${( resource.toString())}`));
|
|
155
160
|
}
|
|
156
161
|
async applyResult(remoteUserData, lastSyncUserData, resourcePreviews, force) {
|
|
157
162
|
const { fileContent } = resourcePreviews[0][0];
|
|
@@ -163,7 +168,11 @@ let KeybindingsSynchroniser = class KeybindingsSynchroniser extends AbstractJson
|
|
|
163
168
|
content = content.trim();
|
|
164
169
|
content = content || '[]';
|
|
165
170
|
if (this.hasErrors(content, true)) {
|
|
166
|
-
throw new UserDataSyncError(localizeWithPath(
|
|
171
|
+
throw ( new UserDataSyncError(localizeWithPath(
|
|
172
|
+
_moduleId,
|
|
173
|
+
0,
|
|
174
|
+
"Unable to sync keybindings because the content in the file is not valid. Please open the file and correct it."
|
|
175
|
+
), "LocalInvalidContent" , this.resource));
|
|
167
176
|
}
|
|
168
177
|
}
|
|
169
178
|
if (localChange !== 0 ) {
|
|
@@ -16,6 +16,7 @@ import { merge, updateIgnoredSettings, isEmpty, getIgnoredSettings } from 'vscod
|
|
|
16
16
|
import { USER_DATA_SYNC_SCHEME, USER_DATA_SYNC_CONFIGURATION_SCOPE, UserDataSyncError } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync';
|
|
17
17
|
import { IUserDataSyncStoreService, IUserDataSyncLocalStoreService, IUserDataSyncLogService, IUserDataSyncUtilService, IUserDataSyncEnablementService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync.service';
|
|
18
18
|
|
|
19
|
+
const _moduleId = "vs/platform/userDataSync/common/settingsSync";
|
|
19
20
|
function isSettingsSyncContent(thing) {
|
|
20
21
|
return thing
|
|
21
22
|
&& (thing.settings && typeof thing.settings === 'string')
|
|
@@ -41,7 +42,7 @@ let SettingsSynchroniser = class SettingsSynchroniser extends AbstractJsonFileSy
|
|
|
41
42
|
const lastSyncUserData = await this.getLastSyncUserData();
|
|
42
43
|
const remoteUserData = await this.getLatestRemoteUserData(manifest, lastSyncUserData);
|
|
43
44
|
const remoteSettingsSyncContent = this.getSettingsSyncContent(remoteUserData);
|
|
44
|
-
const parser = ( new ConfigurationModelParser(USER_DATA_SYNC_CONFIGURATION_SCOPE));
|
|
45
|
+
const parser = ( new ConfigurationModelParser(USER_DATA_SYNC_CONFIGURATION_SCOPE, this.logService));
|
|
45
46
|
if (remoteSettingsSyncContent?.settings) {
|
|
46
47
|
parser.parse(remoteSettingsSyncContent.settings);
|
|
47
48
|
}
|
|
@@ -151,7 +152,7 @@ let SettingsSynchroniser = class SettingsSynchroniser extends AbstractJsonFileSy
|
|
|
151
152
|
};
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
|
-
throw new Error(`Invalid Resource: ${resource.toString()}`);
|
|
155
|
+
throw ( new Error(`Invalid Resource: ${( resource.toString())}`));
|
|
155
156
|
}
|
|
156
157
|
async applyResult(remoteUserData, lastSyncUserData, resourcePreviews, force) {
|
|
157
158
|
const { fileContent } = resourcePreviews[0][0];
|
|
@@ -250,7 +251,11 @@ let SettingsSynchroniser = class SettingsSynchroniser extends AbstractJsonFileSy
|
|
|
250
251
|
}
|
|
251
252
|
validateContent(content) {
|
|
252
253
|
if (this.hasErrors(content, false)) {
|
|
253
|
-
throw new UserDataSyncError(localizeWithPath(
|
|
254
|
+
throw ( new UserDataSyncError(localizeWithPath(
|
|
255
|
+
_moduleId,
|
|
256
|
+
0,
|
|
257
|
+
"Unable to sync settings as there are errors/warning in settings file."
|
|
258
|
+
), "LocalInvalidContent" , this.resource));
|
|
254
259
|
}
|
|
255
260
|
}
|
|
256
261
|
};
|
|
@@ -94,7 +94,7 @@ let SnippetsSynchroniser = class SnippetsSynchroniser extends AbstractSynchronis
|
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
throw new Error(`Invalid Resource: ${resource.toString()}`);
|
|
97
|
+
throw ( new Error(`Invalid Resource: ${( resource.toString())}`));
|
|
98
98
|
}
|
|
99
99
|
async applyResult(remoteUserData, lastSyncUserData, resourcePreviews, force) {
|
|
100
100
|
const accptedResourcePreviews = ( resourcePreviews.map(
|
|
@@ -125,7 +125,7 @@ let TasksSynchroniser = class TasksSynchroniser extends AbstractFileSynchroniser
|
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
throw new Error(`Invalid Resource: ${resource.toString()}`);
|
|
128
|
+
throw ( new Error(`Invalid Resource: ${( resource.toString())}`));
|
|
129
129
|
}
|
|
130
130
|
async applyResult(remoteUserData, lastSyncUserData, resourcePreviews, force) {
|
|
131
131
|
const { fileContent } = resourcePreviews[0][0];
|
|
@@ -17,6 +17,7 @@ import { IUserDataSyncStoreManagementService, IUserDataSyncStoreService, IUserDa
|
|
|
17
17
|
import { IUserDataSyncAccountService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSyncAccount.service';
|
|
18
18
|
import { IUserDataSyncMachinesService } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSyncMachines.service';
|
|
19
19
|
|
|
20
|
+
const _moduleId = "vs/platform/userDataSync/common/userDataAutoSyncService";
|
|
20
21
|
const disableMachineEventuallyKey = 'sync.disableMachineEventually';
|
|
21
22
|
const sessionIdKey = 'sync.sessionId';
|
|
22
23
|
const storeUrlKey = 'sync.storeUrl';
|
|
@@ -406,28 +407,46 @@ class AutoSync extends Disposable {
|
|
|
406
407
|
if (this.manifest === null && (await this.userDataSyncService.hasPreviouslySynced())) {
|
|
407
408
|
if (this.hasSyncServiceChanged()) {
|
|
408
409
|
if (await this.hasDefaultServiceChanged()) {
|
|
409
|
-
throw new UserDataAutoSyncError(
|
|
410
|
+
throw ( new UserDataAutoSyncError(
|
|
411
|
+
localizeWithPath(_moduleId, 0, "Cannot sync because default service has changed"),
|
|
412
|
+
"DefaultServiceChanged"
|
|
413
|
+
));
|
|
410
414
|
}
|
|
411
415
|
else {
|
|
412
|
-
throw new UserDataAutoSyncError(
|
|
416
|
+
throw ( new UserDataAutoSyncError(
|
|
417
|
+
localizeWithPath(_moduleId, 1, "Cannot sync because sync service has changed"),
|
|
418
|
+
"ServiceChanged"
|
|
419
|
+
));
|
|
413
420
|
}
|
|
414
421
|
}
|
|
415
422
|
else {
|
|
416
|
-
throw new UserDataAutoSyncError(
|
|
423
|
+
throw ( new UserDataAutoSyncError(
|
|
424
|
+
localizeWithPath(_moduleId, 2, "Cannot sync because syncing is turned off in the cloud"),
|
|
425
|
+
"TurnedOff"
|
|
426
|
+
));
|
|
417
427
|
}
|
|
418
428
|
}
|
|
419
429
|
const sessionId = this.storageService.get(sessionIdKey, -1 );
|
|
420
430
|
if (sessionId && this.manifest && sessionId !== this.manifest.session) {
|
|
421
431
|
if (this.hasSyncServiceChanged()) {
|
|
422
432
|
if (await this.hasDefaultServiceChanged()) {
|
|
423
|
-
throw new UserDataAutoSyncError(
|
|
433
|
+
throw ( new UserDataAutoSyncError(
|
|
434
|
+
localizeWithPath(_moduleId, 0, "Cannot sync because default service has changed"),
|
|
435
|
+
"DefaultServiceChanged"
|
|
436
|
+
));
|
|
424
437
|
}
|
|
425
438
|
else {
|
|
426
|
-
throw new UserDataAutoSyncError(
|
|
439
|
+
throw ( new UserDataAutoSyncError(
|
|
440
|
+
localizeWithPath(_moduleId, 1, "Cannot sync because sync service has changed"),
|
|
441
|
+
"ServiceChanged"
|
|
442
|
+
));
|
|
427
443
|
}
|
|
428
444
|
}
|
|
429
445
|
else {
|
|
430
|
-
throw new UserDataAutoSyncError(
|
|
446
|
+
throw ( new UserDataAutoSyncError(
|
|
447
|
+
localizeWithPath(_moduleId, 3, "Cannot sync because current session is expired"),
|
|
448
|
+
"SessionExpired"
|
|
449
|
+
));
|
|
431
450
|
}
|
|
432
451
|
}
|
|
433
452
|
const machines = await this.userDataSyncMachinesService.getMachines(this.manifest || undefined);
|
|
@@ -436,7 +455,11 @@ class AutoSync extends Disposable {
|
|
|
436
455
|
}
|
|
437
456
|
const currentMachine = machines.find(machine => machine.isCurrent);
|
|
438
457
|
if (currentMachine?.disabled) {
|
|
439
|
-
throw new UserDataAutoSyncError(localizeWithPath(
|
|
458
|
+
throw ( new UserDataAutoSyncError(localizeWithPath(
|
|
459
|
+
_moduleId,
|
|
460
|
+
4,
|
|
461
|
+
"Cannot sync because syncing is turned off on this machine from another machine."
|
|
462
|
+
), "TurnedOff" ));
|
|
440
463
|
}
|
|
441
464
|
const startTime = ( new Date()).getTime();
|
|
442
465
|
await this.syncTask.run();
|
|
@@ -446,7 +469,10 @@ class AutoSync extends Disposable {
|
|
|
446
469
|
this.manifest = await this.userDataSyncStoreService.manifest(null);
|
|
447
470
|
}
|
|
448
471
|
catch (error) {
|
|
449
|
-
throw new UserDataAutoSyncError(
|
|
472
|
+
throw ( new UserDataAutoSyncError(
|
|
473
|
+
toErrorMessage(error),
|
|
474
|
+
error instanceof UserDataSyncError ? error.code : "Unknown"
|
|
475
|
+
));
|
|
450
476
|
}
|
|
451
477
|
}
|
|
452
478
|
if (this.manifest && this.manifest.session !== sessionId) {
|
|
@@ -35,7 +35,10 @@ let UserDataProfilesManifestSynchroniser = class UserDataProfilesManifestSynchro
|
|
|
35
35
|
}
|
|
36
36
|
async generateSyncPreview(remoteUserData, lastSyncUserData, isRemoteDataFromCurrentMachine) {
|
|
37
37
|
if (!this.userDataProfilesService.isEnabled()) {
|
|
38
|
-
throw new UserDataSyncError(
|
|
38
|
+
throw ( new UserDataSyncError(
|
|
39
|
+
'Cannot sync profiles because they are disabled',
|
|
40
|
+
"LocalError"
|
|
41
|
+
));
|
|
39
42
|
}
|
|
40
43
|
const remoteProfiles = remoteUserData.syncData ? parseUserDataProfilesManifest(remoteUserData.syncData) : null;
|
|
41
44
|
const lastSyncProfiles = lastSyncUserData?.syncData ? parseUserDataProfilesManifest(lastSyncUserData.syncData) : null;
|
|
@@ -82,7 +85,7 @@ let UserDataProfilesManifestSynchroniser = class UserDataProfilesManifestSynchro
|
|
|
82
85
|
if (this.extUri.isEqual(resource, this.previewResource)) {
|
|
83
86
|
return resourcePreview.previewResult;
|
|
84
87
|
}
|
|
85
|
-
throw new Error(`Invalid Resource: ${resource.toString()}`);
|
|
88
|
+
throw ( new Error(`Invalid Resource: ${( resource.toString())}`));
|
|
86
89
|
}
|
|
87
90
|
async acceptLocal(resourcePreview) {
|
|
88
91
|
const localProfiles = this.getLocalUserDataProfiles();
|
|
@@ -135,7 +138,10 @@ let UserDataProfilesManifestSynchroniser = class UserDataProfilesManifestSynchro
|
|
|
135
138
|
}
|
|
136
139
|
const remoteProfiles = resourcePreviews[0][0].remoteProfiles || [];
|
|
137
140
|
if (remoteProfiles.length + (remote?.added.length ?? 0) - (remote?.removed.length ?? 0) > 20) {
|
|
138
|
-
throw new UserDataSyncError(
|
|
141
|
+
throw ( new UserDataSyncError(
|
|
142
|
+
'Too many profiles to sync. Please remove some profiles and try again.',
|
|
143
|
+
"LocalTooManyProfiles"
|
|
144
|
+
));
|
|
139
145
|
}
|
|
140
146
|
if (localChange !== 0 ) {
|
|
141
147
|
await this.backupLocal(stringifyLocalProfiles(this.getLocalUserDataProfiles(), false));
|
|
@@ -144,28 +150,22 @@ let UserDataProfilesManifestSynchroniser = class UserDataProfilesManifestSynchro
|
|
|
144
150
|
await this.userDataProfilesService.removeProfile(profile);
|
|
145
151
|
this.logService.info(`${this.syncResourceLogLabel}: Removed profile '${profile.name}'.`);
|
|
146
152
|
})));
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
})());
|
|
154
|
-
}
|
|
155
|
-
for (const profile of local.updated) {
|
|
153
|
+
await Promise.all(( local.added.map(async (profile) => {
|
|
154
|
+
this.logService.trace(`${this.syncResourceLogLabel}: Creating '${profile.name}' profile...`);
|
|
155
|
+
await this.userDataProfilesService.createProfile(profile.id, profile.name, { shortName: profile.shortName, icon: profile.icon, useDefaultFlags: profile.useDefaultFlags });
|
|
156
|
+
this.logService.info(`${this.syncResourceLogLabel}: Created profile '${profile.name}'.`);
|
|
157
|
+
})));
|
|
158
|
+
await Promise.all(( local.updated.map(async (profile) => {
|
|
156
159
|
const localProfile = this.userDataProfilesService.profiles.find(p => p.id === profile.id);
|
|
157
160
|
if (localProfile) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
this.logService.info(`${this.syncResourceLogLabel}: Updated profile '${profile.name}'.`);
|
|
162
|
-
})());
|
|
161
|
+
this.logService.trace(`${this.syncResourceLogLabel}: Updating '${profile.name}' profile...`);
|
|
162
|
+
await this.userDataProfilesService.updateProfile(localProfile, { name: profile.name, shortName: profile.shortName, icon: profile.icon, useDefaultFlags: profile.useDefaultFlags });
|
|
163
|
+
this.logService.info(`${this.syncResourceLogLabel}: Updated profile '${profile.name}'.`);
|
|
163
164
|
}
|
|
164
165
|
else {
|
|
165
166
|
this.logService.info(`${this.syncResourceLogLabel}: Could not find profile with id '${profile.id}' to update.`);
|
|
166
167
|
}
|
|
167
|
-
}
|
|
168
|
-
await Promise.all(promises);
|
|
168
|
+
})));
|
|
169
169
|
}
|
|
170
170
|
if (remoteChange !== 0 ) {
|
|
171
171
|
this.logService.trace(`${this.syncResourceLogLabel}: Updating remote profiles...`);
|
|
@@ -6,14 +6,11 @@ import { AbstractLogger } from 'vscode/vscode/vs/platform/log/common/log';
|
|
|
6
6
|
import { ILoggerService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
7
7
|
import { USER_DATA_SYNC_LOG_ID } from 'vscode/vscode/vs/platform/userDataSync/common/userDataSync';
|
|
8
8
|
|
|
9
|
+
const _moduleId = "vs/platform/userDataSync/common/userDataSyncLog";
|
|
9
10
|
let UserDataSyncLogService = class UserDataSyncLogService extends AbstractLogger {
|
|
10
11
|
constructor(loggerService, environmentService) {
|
|
11
12
|
super();
|
|
12
|
-
this.logger = this._register(loggerService.createLogger(joinPath(environmentService.logsHome, `${USER_DATA_SYNC_LOG_ID}.log`), { id: USER_DATA_SYNC_LOG_ID, name: ( localizeWithPath(
|
|
13
|
-
'vs/platform/userDataSync/common/userDataSyncLog',
|
|
14
|
-
'userDataSyncLog',
|
|
15
|
-
"Settings Sync"
|
|
16
|
-
)) }));
|
|
13
|
+
this.logger = this._register(loggerService.createLogger(joinPath(environmentService.logsHome, `${USER_DATA_SYNC_LOG_ID}.log`), { id: USER_DATA_SYNC_LOG_ID, name: ( localizeWithPath(_moduleId, 0, "Settings Sync")) }));
|
|
17
14
|
}
|
|
18
15
|
trace(message, ...args) {
|
|
19
16
|
this.logger.trace(message, ...args);
|
|
@@ -34,9 +31,9 @@ let UserDataSyncLogService = class UserDataSyncLogService extends AbstractLogger
|
|
|
34
31
|
this.logger.flush();
|
|
35
32
|
}
|
|
36
33
|
};
|
|
37
|
-
UserDataSyncLogService = ( __decorate([
|
|
38
|
-
( __param(0, ILoggerService)),
|
|
39
|
-
( __param(1, IEnvironmentService))
|
|
40
|
-
], UserDataSyncLogService));
|
|
34
|
+
UserDataSyncLogService = ( (__decorate([
|
|
35
|
+
( (__param(0, ILoggerService))),
|
|
36
|
+
( (__param(1, IEnvironmentService)))
|
|
37
|
+
], UserDataSyncLogService)));
|
|
41
38
|
|
|
42
39
|
export { UserDataSyncLogService };
|
|
@@ -23,6 +23,7 @@ import { toFormattedString } from 'vscode/vscode/vs/base/common/jsonFormatter';
|
|
|
23
23
|
import { trim } from 'vscode/vscode/vs/base/common/strings';
|
|
24
24
|
|
|
25
25
|
var UserDataSyncResourceProviderService_1;
|
|
26
|
+
const _moduleId = "vs/platform/userDataSync/common/userDataSyncResourceProvider";
|
|
26
27
|
let UserDataSyncResourceProviderService = class UserDataSyncResourceProviderService {
|
|
27
28
|
static { UserDataSyncResourceProviderService_1 = this; }
|
|
28
29
|
static { this.NOT_EXISTING_RESOURCE = 'not-existing-resource'; }
|
|
@@ -427,7 +428,11 @@ let UserDataSyncResourceProviderService = class UserDataSyncResourceProviderServ
|
|
|
427
428
|
catch (error) {
|
|
428
429
|
this.logService.error(error);
|
|
429
430
|
}
|
|
430
|
-
throw new UserDataSyncError(localizeWithPath(
|
|
431
|
+
throw ( new UserDataSyncError(localizeWithPath(
|
|
432
|
+
_moduleId,
|
|
433
|
+
0,
|
|
434
|
+
"Cannot parse sync data as it is not compatible with the current version."
|
|
435
|
+
), "IncompatibleRemoteContent" , syncResource));
|
|
431
436
|
}
|
|
432
437
|
async getUserData(syncResource, ref, collection) {
|
|
433
438
|
const content = await this.userDataSyncStoreService.resolveResourceContent(syncResource, ref, collection);
|
|
@@ -102,7 +102,10 @@ let UserDataSyncService = class UserDataSyncService extends Disposable {
|
|
|
102
102
|
async createManualSyncTask() {
|
|
103
103
|
this.checkEnablement();
|
|
104
104
|
if (this.userDataSyncEnablementService.isEnabled()) {
|
|
105
|
-
throw new UserDataSyncError(
|
|
105
|
+
throw ( new UserDataSyncError(
|
|
106
|
+
'Cannot start manual sync when sync is enabled',
|
|
107
|
+
"LocalError"
|
|
108
|
+
));
|
|
106
109
|
}
|
|
107
110
|
this.logService.info('Sync started.');
|
|
108
111
|
const startTime = ( new Date()).getTime();
|
|
@@ -486,7 +489,7 @@ let UserDataSyncService = class UserDataSyncService extends Disposable {
|
|
|
486
489
|
}
|
|
487
490
|
checkEnablement() {
|
|
488
491
|
if (!this.userDataSyncStoreManagementService.userDataSyncStore) {
|
|
489
|
-
throw new Error('Not enabled');
|
|
492
|
+
throw ( new Error('Not enabled'));
|
|
490
493
|
}
|
|
491
494
|
}
|
|
492
495
|
};
|
|
@@ -16,6 +16,7 @@ import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/h
|
|
|
16
16
|
import { SHOW_SYNC_LOG_COMMAND_ID } from 'vscode/vscode/vs/workbench/services/userDataSync/common/userDataSync';
|
|
17
17
|
import Severity$1 from 'vscode/vscode/vs/base/common/severity';
|
|
18
18
|
|
|
19
|
+
const _moduleId = "vs/workbench/contrib/userDataSync/browser/userDataSync.contribution";
|
|
19
20
|
let UserDataSyncReportIssueContribution = class UserDataSyncReportIssueContribution extends Disposable {
|
|
20
21
|
constructor(userDataAutoSyncService, notificationService, productService, commandService, hostService) {
|
|
21
22
|
super();
|
|
@@ -29,14 +30,14 @@ let UserDataSyncReportIssueContribution = class UserDataSyncReportIssueContribut
|
|
|
29
30
|
switch (error.code) {
|
|
30
31
|
case "LocalTooManyRequests" : {
|
|
31
32
|
const message = isWeb ? ( localizeWithPath(
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
_moduleId,
|
|
34
|
+
0,
|
|
34
35
|
"Settings sync is suspended temporarily because the current device is making too many requests. Please reload {0} to resume.",
|
|
35
36
|
this.productService.nameLong
|
|
36
37
|
))
|
|
37
38
|
: ( localizeWithPath(
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
_moduleId,
|
|
40
|
+
1,
|
|
40
41
|
"Settings sync is suspended temporarily because the current device is making too many requests. Please restart {0} to resume.",
|
|
41
42
|
this.productService.nameLong
|
|
42
43
|
));
|
|
@@ -45,53 +46,27 @@ let UserDataSyncReportIssueContribution = class UserDataSyncReportIssueContribut
|
|
|
45
46
|
message,
|
|
46
47
|
actions: {
|
|
47
48
|
primary: [
|
|
48
|
-
( new Action('Show Sync Logs', ( localizeWithPath(
|
|
49
|
-
|
|
50
|
-
'show sync logs',
|
|
51
|
-
"Show Log"
|
|
52
|
-
)), undefined, true, () => this.commandService.executeCommand(SHOW_SYNC_LOG_COMMAND_ID))),
|
|
53
|
-
( new Action('Restart', isWeb ? ( localizeWithPath(
|
|
54
|
-
'vs/workbench/contrib/userDataSync/browser/userDataSync.contribution',
|
|
55
|
-
'reload',
|
|
56
|
-
"Reload"
|
|
57
|
-
)) : ( localizeWithPath(
|
|
58
|
-
'vs/workbench/contrib/userDataSync/browser/userDataSync.contribution',
|
|
59
|
-
'restart',
|
|
60
|
-
"Restart"
|
|
61
|
-
)), undefined, true, () => this.hostService.restart()))
|
|
49
|
+
( (new Action('Show Sync Logs', ( localizeWithPath(_moduleId, 2, "Show Log")), undefined, true, () => this.commandService.executeCommand(SHOW_SYNC_LOG_COMMAND_ID)))),
|
|
50
|
+
( (new Action('Restart', isWeb ? ( localizeWithPath(_moduleId, 3, "Reload")) : ( localizeWithPath(_moduleId, 4, "Restart")), undefined, true, () => this.hostService.restart())))
|
|
62
51
|
]
|
|
63
52
|
}
|
|
64
53
|
});
|
|
65
54
|
return;
|
|
66
55
|
}
|
|
67
56
|
case "RemoteTooManyRequests" : {
|
|
68
|
-
const operationId = error.operationId ? ( localizeWithPath(
|
|
69
|
-
'vs/workbench/contrib/userDataSync/browser/userDataSync.contribution',
|
|
70
|
-
'operationId',
|
|
71
|
-
"Operation Id: {0}",
|
|
72
|
-
error.operationId
|
|
73
|
-
)) : undefined;
|
|
57
|
+
const operationId = error.operationId ? ( localizeWithPath(_moduleId, 5, "Operation Id: {0}", error.operationId)) : undefined;
|
|
74
58
|
const message = ( localizeWithPath(
|
|
75
|
-
|
|
76
|
-
|
|
59
|
+
_moduleId,
|
|
60
|
+
6,
|
|
77
61
|
"Settings sync is disabled because the current device is making too many requests. Please wait for 10 minutes and turn on sync."
|
|
78
62
|
));
|
|
79
63
|
this.notificationService.notify({
|
|
80
64
|
severity: Severity$1.Error,
|
|
81
65
|
message: operationId ? `${message} ${operationId}` : message,
|
|
82
|
-
source: error.operationId ? ( localizeWithPath(
|
|
83
|
-
'vs/workbench/contrib/userDataSync/browser/userDataSync.contribution',
|
|
84
|
-
'settings sync',
|
|
85
|
-
"Settings Sync. Operation Id: {0}",
|
|
86
|
-
error.operationId
|
|
87
|
-
)) : undefined,
|
|
66
|
+
source: error.operationId ? ( localizeWithPath(_moduleId, 7, "Settings Sync. Operation Id: {0}", error.operationId)) : undefined,
|
|
88
67
|
actions: {
|
|
89
68
|
primary: [
|
|
90
|
-
( new Action('Show Sync Logs', ( localizeWithPath(
|
|
91
|
-
'vs/workbench/contrib/userDataSync/browser/userDataSync.contribution',
|
|
92
|
-
'show sync logs',
|
|
93
|
-
"Show Log"
|
|
94
|
-
)), undefined, true, () => this.commandService.executeCommand(SHOW_SYNC_LOG_COMMAND_ID))),
|
|
69
|
+
( (new Action('Show Sync Logs', ( localizeWithPath(_moduleId, 2, "Show Log")), undefined, true, () => this.commandService.executeCommand(SHOW_SYNC_LOG_COMMAND_ID)))),
|
|
95
70
|
]
|
|
96
71
|
}
|
|
97
72
|
});
|
|
@@ -100,14 +75,14 @@ let UserDataSyncReportIssueContribution = class UserDataSyncReportIssueContribut
|
|
|
100
75
|
}
|
|
101
76
|
}
|
|
102
77
|
};
|
|
103
|
-
UserDataSyncReportIssueContribution = ( __decorate([
|
|
104
|
-
( __param(0, IUserDataAutoSyncService)),
|
|
105
|
-
( __param(1, INotificationService)),
|
|
106
|
-
( __param(2, IProductService)),
|
|
107
|
-
( __param(3, ICommandService)),
|
|
108
|
-
( __param(4, IHostService))
|
|
109
|
-
], UserDataSyncReportIssueContribution));
|
|
110
|
-
const workbenchRegistry = ( Registry.as(Extensions.Workbench));
|
|
78
|
+
UserDataSyncReportIssueContribution = ( (__decorate([
|
|
79
|
+
( (__param(0, IUserDataAutoSyncService))),
|
|
80
|
+
( (__param(1, INotificationService))),
|
|
81
|
+
( (__param(2, IProductService))),
|
|
82
|
+
( (__param(3, ICommandService))),
|
|
83
|
+
( (__param(4, IHostService)))
|
|
84
|
+
], UserDataSyncReportIssueContribution)));
|
|
85
|
+
const workbenchRegistry = ( (Registry.as(Extensions.Workbench)));
|
|
111
86
|
workbenchRegistry.registerWorkbenchContribution(UserDataSyncWorkbenchContribution, 3 );
|
|
112
87
|
workbenchRegistry.registerWorkbenchContribution(UserDataSyncTrigger, 4 );
|
|
113
88
|
workbenchRegistry.registerWorkbenchContribution(UserDataSyncReportIssueContribution, 4 );
|