mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
committed by
GitHub
parent
209eccdea2
commit
f8b75e03e2
@@ -182,7 +182,7 @@ export class UserDataProfilesManifestSynchroniser extends AbstractSynchroniser i
|
||||
await this.backupLocal(this.stringifyLocalProfiles(this.getLocalUserDataProfiles(), false));
|
||||
const promises: Promise<any>[] = [];
|
||||
for (const profile of local.added) {
|
||||
promises.push(this.userDataProfilesService.createProfile(profile.id, profile.name));
|
||||
promises.push(this.userDataProfilesService.createProfile(profile.id, profile.name, { shortName: profile.shortName }));
|
||||
}
|
||||
for (const profile of local.removed) {
|
||||
promises.push(this.userDataProfilesService.removeProfile(profile));
|
||||
|
||||
@@ -100,7 +100,7 @@ suite('UserDataProfilesManifestSync', () => {
|
||||
assert.deepStrictEqual(testObject.conflicts.conflicts, []);
|
||||
|
||||
const profiles = getLocalProfiles(testClient);
|
||||
assert.deepStrictEqual(profiles, [{ id: '1', name: 'name 1' }]);
|
||||
assert.deepStrictEqual(profiles, [{ id: '1', name: 'name 1', shortName: undefined }]);
|
||||
});
|
||||
|
||||
test('first time sync when profiles exists', async () => {
|
||||
@@ -113,7 +113,7 @@ suite('UserDataProfilesManifestSync', () => {
|
||||
assert.deepStrictEqual(testObject.conflicts.conflicts, []);
|
||||
|
||||
const profiles = getLocalProfiles(testClient);
|
||||
assert.deepStrictEqual(profiles, [{ id: '1', name: 'name 1' }, { id: '2', name: 'name 2' }]);
|
||||
assert.deepStrictEqual(profiles, [{ id: '1', name: 'name 1', shortName: undefined }, { id: '2', name: 'name 2', shortName: undefined }]);
|
||||
|
||||
const { content } = await testClient.read(testObject.resource);
|
||||
assert.ok(content !== null);
|
||||
@@ -132,7 +132,7 @@ suite('UserDataProfilesManifestSync', () => {
|
||||
assert.deepStrictEqual(testObject.conflicts.conflicts, []);
|
||||
|
||||
const profiles = getLocalProfiles(testClient);
|
||||
assert.deepStrictEqual(profiles, [{ id: '1', name: 'name 1' }]);
|
||||
assert.deepStrictEqual(profiles, [{ id: '1', name: 'name 1', shortName: undefined }]);
|
||||
|
||||
const { content } = await testClient.read(testObject.resource);
|
||||
assert.ok(content !== null);
|
||||
@@ -141,7 +141,7 @@ suite('UserDataProfilesManifestSync', () => {
|
||||
});
|
||||
|
||||
test('sync adding a profile', async () => {
|
||||
await testClient.instantiationService.get(IUserDataProfilesService).createProfile('1', 'name 1');
|
||||
await testClient.instantiationService.get(IUserDataProfilesService).createProfile('1', 'name 1', { shortName: 'short 1' });
|
||||
await testObject.sync(await testClient.getResourceManifest());
|
||||
await client2.sync();
|
||||
|
||||
@@ -149,15 +149,15 @@ suite('UserDataProfilesManifestSync', () => {
|
||||
await testObject.sync(await testClient.getResourceManifest());
|
||||
assert.strictEqual(testObject.status, SyncStatus.Idle);
|
||||
assert.deepStrictEqual(testObject.conflicts.conflicts, []);
|
||||
assert.deepStrictEqual(getLocalProfiles(testClient), [{ id: '1', name: 'name 1' }, { id: '2', name: 'name 2' }]);
|
||||
assert.deepStrictEqual(getLocalProfiles(testClient), [{ id: '1', name: 'name 1', shortName: 'short 1' }, { id: '2', name: 'name 2', shortName: undefined }]);
|
||||
|
||||
await client2.sync();
|
||||
assert.deepStrictEqual(getLocalProfiles(client2), [{ id: '1', name: 'name 1' }, { id: '2', name: 'name 2' }]);
|
||||
assert.deepStrictEqual(getLocalProfiles(client2), [{ id: '1', name: 'name 1', shortName: 'short 1' }, { id: '2', name: 'name 2', shortName: undefined }]);
|
||||
|
||||
const { content } = await testClient.read(testObject.resource);
|
||||
assert.ok(content !== null);
|
||||
const actual = parseRemoteProfiles(content!);
|
||||
assert.deepStrictEqual(actual, [{ id: '1', name: 'name 1', collection: '1' }, { id: '2', name: 'name 2', collection: '2' }]);
|
||||
assert.deepStrictEqual(actual, [{ id: '1', name: 'name 1', collection: '1', shortName: 'short 1' }, { id: '2', name: 'name 2', collection: '2' }]);
|
||||
});
|
||||
|
||||
test('sync updating a profile', async () => {
|
||||
@@ -169,10 +169,10 @@ suite('UserDataProfilesManifestSync', () => {
|
||||
await testObject.sync(await testClient.getResourceManifest());
|
||||
assert.strictEqual(testObject.status, SyncStatus.Idle);
|
||||
assert.deepStrictEqual(testObject.conflicts.conflicts, []);
|
||||
assert.deepStrictEqual(getLocalProfiles(testClient), [{ id: '1', name: 'name 2' }]);
|
||||
assert.deepStrictEqual(getLocalProfiles(testClient), [{ id: '1', name: 'name 2', shortName: '2' }]);
|
||||
|
||||
await client2.sync();
|
||||
assert.deepStrictEqual(getLocalProfiles(client2), [{ id: '1', name: 'name 2' }]);
|
||||
assert.deepStrictEqual(getLocalProfiles(client2), [{ id: '1', name: 'name 2', shortName: '2' }]);
|
||||
|
||||
const { content } = await testClient.read(testObject.resource);
|
||||
assert.ok(content !== null);
|
||||
@@ -190,10 +190,10 @@ suite('UserDataProfilesManifestSync', () => {
|
||||
await testObject.sync(await testClient.getResourceManifest());
|
||||
assert.strictEqual(testObject.status, SyncStatus.Idle);
|
||||
assert.deepStrictEqual(testObject.conflicts.conflicts, []);
|
||||
assert.deepStrictEqual(getLocalProfiles(testClient), [{ id: '2', name: 'name 2' }]);
|
||||
assert.deepStrictEqual(getLocalProfiles(testClient), [{ id: '2', name: 'name 2', shortName: undefined }]);
|
||||
|
||||
await client2.sync();
|
||||
assert.deepStrictEqual(getLocalProfiles(client2), [{ id: '2', name: 'name 2' }]);
|
||||
assert.deepStrictEqual(getLocalProfiles(client2), [{ id: '2', name: 'name 2', shortName: undefined }]);
|
||||
|
||||
const { content } = await testClient.read(testObject.resource);
|
||||
assert.ok(content !== null);
|
||||
@@ -206,10 +206,10 @@ suite('UserDataProfilesManifestSync', () => {
|
||||
return JSON.parse(syncData.content);
|
||||
}
|
||||
|
||||
function getLocalProfiles(client: UserDataSyncClient): { id: string; name: string }[] {
|
||||
function getLocalProfiles(client: UserDataSyncClient): { id: string; name: string; shortName?: string }[] {
|
||||
return client.instantiationService.get(IUserDataProfilesService).profiles
|
||||
.slice(1).sort((a, b) => a.name.localeCompare(b.name))
|
||||
.map(profile => ({ id: profile.id, name: profile.name }));
|
||||
.map(profile => ({ id: profile.id, name: profile.name, shortName: profile.shortName }));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -587,7 +587,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
|
||||
}
|
||||
|
||||
private getConfigureSyncQuickPickItems(): ConfigureSyncQuickPickItem[] {
|
||||
return [{
|
||||
const result = [{
|
||||
id: SyncResource.Settings,
|
||||
label: getSyncAreaLabel(SyncResource.Settings)
|
||||
}, {
|
||||
@@ -607,6 +607,13 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
|
||||
id: SyncResource.GlobalState,
|
||||
label: getSyncAreaLabel(SyncResource.GlobalState),
|
||||
}];
|
||||
if (this.productService.enableSyncingProfiles) {
|
||||
result.push({
|
||||
id: SyncResource.Profiles,
|
||||
label: getSyncAreaLabel(SyncResource.Profiles),
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private updateConfiguration(items: ConfigureSyncQuickPickItem[], selectedItems: ReadonlyArray<ConfigureSyncQuickPickItem>): void {
|
||||
|
||||
Reference in New Issue
Block a user