Skip to content

Commit 4ffcfff

Browse files
committed
prepare to merge to master
1 parent b3771f1 commit 4ffcfff

12 files changed

Lines changed: 119 additions & 119 deletions

src/vs/vscode.proposed.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ declare module 'vscode' {
10201020

10211021
export namespace window {
10221022

1023-
export function registerUserDataProvider(name: string, userDataProvider: UserDataProvider): Disposable;
1023+
export function registerUserDataSyncProvider(name: string, userDataProvider: UserDataSyncProvider): Disposable;
10241024

10251025
}
10261026

@@ -1034,7 +1034,7 @@ declare module 'vscode' {
10341034
constructor();
10351035
}
10361036

1037-
export interface UserDataProvider {
1037+
export interface UserDataSyncProvider {
10381038

10391039
read(key: string): Promise<{ content: string, ref: string } | null>;
10401040

src/vs/workbench/api/browser/mainThreadUserData.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
77
import { MainContext, ExtHostContext, IExtHostContext, MainThreadUserDataShape, ExtHostUserDataShape } from '../common/extHost.protocol';
88
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
9-
import { IRemoteUserDataService, IUserData } from 'vs/workbench/services/userData/common/userData';
9+
import { IUserDataSyncStoreService, IUserData } from 'vs/workbench/services/userData/common/userData';
1010

1111
@extHostNamedCustomer(MainContext.MainThreadUserData)
1212
export class MainThreadUserData extends Disposable implements MainThreadUserDataShape {
@@ -15,16 +15,16 @@ export class MainThreadUserData extends Disposable implements MainThreadUserData
1515

1616
constructor(
1717
extHostContext: IExtHostContext,
18-
@IRemoteUserDataService private readonly remoteUserDataService: IRemoteUserDataService
18+
@IUserDataSyncStoreService private readonly userDataSyncStoreService: IUserDataSyncStoreService
1919
) {
2020
super();
2121
this.proxy = extHostContext.getProxy(ExtHostContext.ExtHostUserData);
22-
this._register(toDisposable(() => this.remoteUserDataService.deregisterRemoteUserDataProvider()));
22+
this._register(toDisposable(() => this.userDataSyncStoreService.deregisterUserDataSyncStore()));
2323
}
2424

2525
$registerUserDataProvider(name: string): void {
2626
const proxy = this.proxy;
27-
this.remoteUserDataService.registerRemoteUserDataProvider(name, {
27+
this.userDataSyncStoreService.registerUserDataSyncStore(name, {
2828
read(key: string): Promise<IUserData | null> {
2929
return proxy.$read(key);
3030
},
@@ -35,7 +35,7 @@ export class MainThreadUserData extends Disposable implements MainThreadUserData
3535
}
3636

3737
$deregisterUserDataProvider(): void {
38-
this.remoteUserDataService.deregisterRemoteUserDataProvider();
38+
this.userDataSyncStoreService.deregisterUserDataSyncStore();
3939
}
4040

4141
}

src/vs/workbench/api/common/extHost.api.impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
542542
createInputBox(): vscode.InputBox {
543543
return extHostQuickOpen.createInputBox(extension.identifier);
544544
},
545-
registerUserDataProvider: (identity: string, userDataProvider: vscode.UserDataProvider): vscode.Disposable => {
545+
registerUserDataSyncProvider: (identity: string, userDataProvider: vscode.UserDataSyncProvider): vscode.Disposable => {
546546
checkProposedApiEnabled(extension);
547547
return extHostUserData.registerUserDataProvider(identity, userDataProvider);
548548
}

src/vs/workbench/api/common/extHostTypes.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { generateUuid } from 'vs/base/common/uuid';
1414
import * as vscode from 'vscode';
1515
import { FileSystemProviderErrorCode, markAsFileSystemProviderError } from 'vs/platform/files/common/files';
1616
import { RemoteAuthorityResolverErrorCode } from 'vs/platform/remote/common/remoteAuthorityResolver';
17-
import { RemoteUserDataErrorCode, markAsUserDataError } from 'vs/workbench/services/userData/common/userData';
17+
import { UserDataSyncStoreErrorCode, markAsUserDataSyncStoreError } from 'vs/workbench/services/userData/common/userData';
1818

1919
function es5ClassCompat(target: Function): any {
2020
///@ts-ignore
@@ -2373,15 +2373,15 @@ export class Decoration {
23732373
export class UserDataError extends Error {
23742374

23752375
static Rejected(message?: string): UserDataError {
2376-
return new UserDataError(message, RemoteUserDataErrorCode.Rejected);
2376+
return new UserDataError(message, UserDataSyncStoreErrorCode.Rejected);
23772377
}
23782378

2379-
constructor(message?: string, code: RemoteUserDataErrorCode = RemoteUserDataErrorCode.Unknown) {
2379+
constructor(message?: string, code: UserDataSyncStoreErrorCode = UserDataSyncStoreErrorCode.Unknown) {
23802380
super(message);
23812381

23822382
// mark the error as user data provider error so that
23832383
// we can extract the error code on the receiving side
2384-
markAsUserDataError(this, code);
2384+
markAsUserDataSyncStoreError(this, code);
23852385

23862386
// workaround when extending builtin objects and when compiling to ES5, see:
23872387
// https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work

src/vs/workbench/api/common/extHostUserData.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ import { IUserData } from 'vs/workbench/services/userData/common/userData';
1212
export class ExtHostUserData implements ExtHostUserDataShape {
1313

1414
private name: string | null = null;
15-
private userDataProvider: vscode.UserDataProvider | null = null;
15+
private userDataProvider: vscode.UserDataSyncProvider | null = null;
1616

1717
constructor(
1818
private readonly proxy: MainThreadUserDataShape,
1919
private readonly logService: ILogService,
2020
) {
2121
}
2222

23-
registerUserDataProvider(name: string, userDataProvider: vscode.UserDataProvider): vscode.Disposable {
23+
registerUserDataProvider(name: string, userDataProvider: vscode.UserDataSyncProvider): vscode.Disposable {
2424
if (this.userDataProvider) {
2525
this.logService.warn(`A user data provider '${this.name}' already exists hence ignoring the remote user data provider '${name}'.`);
2626
return Disposable.None;

src/vs/workbench/contrib/userData/browser/userData.contribution.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from 'vs/workbench/common/contributions';
7-
import { IUserDataSyncService, SyncStatus, USER_DATA_PREVIEW_SCHEME, IRemoteUserDataService } from 'vs/workbench/services/userData/common/userData';
7+
import { IUserDataSyncService, SyncStatus, USER_DATA_PREVIEW_SCHEME, IUserDataSyncStoreService } from 'vs/workbench/services/userData/common/userData';
88
import { localize } from 'vs/nls';
99
import { Disposable, MutableDisposable, toDisposable } from 'vs/base/common/lifecycle';
1010
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
@@ -48,21 +48,21 @@ class UserDataSyncContribution extends Disposable implements IWorkbenchContribut
4848
constructor(
4949
@IConfigurationService private readonly configurationService: IConfigurationService,
5050
@IUserDataSyncService private readonly userDataSyncService: IUserDataSyncService,
51-
@IRemoteUserDataService private readonly remoteUserDataService: IRemoteUserDataService,
51+
@IUserDataSyncStoreService private readonly userDataSyncStoreService: IUserDataSyncStoreService,
5252
) {
5353
super();
5454
this.sync(true);
5555
this._register(Event.any<any>(
5656
Event.filter(this.configurationService.onDidChangeConfiguration, e => e.affectsConfiguration('userConfiguration.enableSync') && this.configurationService.getValue<boolean>('userConfiguration.enableSync')),
57-
this.remoteUserDataService.onDidChangeEnablement)
57+
this.userDataSyncStoreService.onDidChangeEnablement)
5858
(() => this.sync(true)));
5959

6060
// Sync immediately if there is a local change.
6161
this._register(Event.debounce(this.userDataSyncService.onDidChangeLocal, () => undefined, 500)(() => this.sync(false)));
6262
}
6363

6464
private async sync(loop: boolean): Promise<void> {
65-
if (this.configurationService.getValue<boolean>('userConfiguration.enableSync') && this.remoteUserDataService.isEnabled()) {
65+
if (this.configurationService.getValue<boolean>('userConfiguration.enableSync') && this.userDataSyncStoreService.isEnabled()) {
6666
try {
6767
await this.userDataSyncService.sync();
6868
} catch (e) {

src/vs/workbench/services/userData/common/remoteUserDataService.ts

Lines changed: 0 additions & 70 deletions
This file was deleted.

src/vs/workbench/services/userData/common/settingsSync.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
88
import { IFileService, FileSystemProviderErrorCode, FileSystemProviderError, IFileContent } from 'vs/platform/files/common/files';
99
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
1010
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
11-
import { IRemoteUserDataService, IUserData, RemoteUserDataError, RemoteUserDataErrorCode, ISynchroniser, SyncStatus, SETTINGS_PREVIEW_RESOURCE } from 'vs/workbench/services/userData/common/userData';
11+
import { IUserDataSyncStoreService, IUserData, UserDataSyncStoreError, UserDataSyncStoreErrorCode, ISynchroniser, SyncStatus, SETTINGS_PREVIEW_RESOURCE } from 'vs/workbench/services/userData/common/userData';
1212
import { VSBuffer } from 'vs/base/common/buffer';
1313
import { parse, findNodeAtLocation, parseTree, ParseError } from 'vs/base/common/json';
1414
import { ITextModel } from 'vs/editor/common/model';
@@ -54,7 +54,7 @@ export class SettingsSynchroniser extends Disposable implements ISynchroniser {
5454
@IFileService private readonly fileService: IFileService,
5555
@IWorkbenchEnvironmentService private readonly workbenchEnvironmentService: IWorkbenchEnvironmentService,
5656
@IStorageService private readonly storageService: IStorageService,
57-
@IRemoteUserDataService private readonly remoteUserDataService: IRemoteUserDataService,
57+
@IUserDataSyncStoreService private readonly userDataSyncStoreService: IUserDataSyncStoreService,
5858
@IModelService private readonly modelService: IModelService,
5959
@IModeService private readonly modeService: IModeService,
6060
@IEditorService private readonly editorService: IEditorService,
@@ -107,7 +107,7 @@ export class SettingsSynchroniser extends Disposable implements ISynchroniser {
107107
} catch (e) {
108108
this.syncPreviewResultPromise = null;
109109
this.setStatus(SyncStatus.Idle);
110-
if (e instanceof RemoteUserDataError && e.code === RemoteUserDataErrorCode.Rejected) {
110+
if (e instanceof UserDataSyncStoreError && e.code === UserDataSyncStoreErrorCode.Rejected) {
111111
// Rejected as there is a new remote version. Syncing again,
112112
this.logService.info('Failed to Synchronise settings as there is a new remote version available. Synchronising again...');
113113
return this.sync();
@@ -193,7 +193,7 @@ export class SettingsSynchroniser extends Disposable implements ISynchroniser {
193193
}
194194

195195
private async generatePreview(): Promise<ISyncPreviewResult> {
196-
const remoteUserData = await this.remoteUserDataService.read(SettingsSynchroniser.EXTERNAL_USER_DATA_SETTINGS_KEY);
196+
const remoteUserData = await this.userDataSyncStoreService.read(SettingsSynchroniser.EXTERNAL_USER_DATA_SETTINGS_KEY);
197197
// Get file content last to get the latest
198198
const fileContent = await this.getLocalFileContent();
199199
const { settingsPreview, hasLocalChanged, hasRemoteChanged, hasConflicts } = this.computeChanges(fileContent, remoteUserData);
@@ -433,7 +433,7 @@ export class SettingsSynchroniser extends Disposable implements ISynchroniser {
433433
}
434434

435435
private async writeToRemote(content: string, ref: string | null): Promise<string> {
436-
return this.remoteUserDataService.write(SettingsSynchroniser.EXTERNAL_USER_DATA_SETTINGS_KEY, content, ref);
436+
return this.userDataSyncStoreService.write(SettingsSynchroniser.EXTERNAL_USER_DATA_SETTINGS_KEY, content, ref);
437437
}
438438

439439
private async writeToLocal(newContent: string, oldContent: IFileContent | null): Promise<void> {

src/vs/workbench/services/userData/common/userData.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,72 +12,72 @@ export interface IUserData {
1212
content: string;
1313
}
1414

15-
export enum RemoteUserDataErrorCode {
15+
export enum UserDataSyncStoreErrorCode {
1616
Rejected = 'Rejected',
1717
Unknown = 'Unknown'
1818
}
1919

20-
export function markAsUserDataError(error: Error, code: RemoteUserDataErrorCode): Error {
21-
error.name = code ? `${code} (UserDataError)` : `UserDataError`;
20+
export function markAsUserDataSyncStoreError(error: Error, code: UserDataSyncStoreErrorCode): Error {
21+
error.name = code ? `${code} (UserDataSyncStoreError)` : `UserDataSyncStoreError`;
2222

2323
return error;
2424
}
2525

26-
export function toUserDataErrorCode(error: Error | undefined | null): RemoteUserDataErrorCode {
26+
export function toUserDataSyncStoreErrorCode(error: Error | undefined | null): UserDataSyncStoreErrorCode {
2727

2828
// Guard against abuse
2929
if (!error) {
30-
return RemoteUserDataErrorCode.Unknown;
30+
return UserDataSyncStoreErrorCode.Unknown;
3131
}
3232

3333
// FileSystemProviderError comes with the code
34-
if (error instanceof RemoteUserDataError) {
34+
if (error instanceof UserDataSyncStoreError) {
3535
return error.code;
3636
}
3737

3838
// Any other error, check for name match by assuming that the error
39-
// went through the markAsFileSystemProviderError() method
40-
const match = /^(.+) \(UserDataError\)$/.exec(error.name);
39+
// went through the markAsUserDataSyncStoreError() method
40+
const match = /^(.+) \(UserDataSyncStoreError\)$/.exec(error.name);
4141
if (!match) {
42-
return RemoteUserDataErrorCode.Unknown;
42+
return UserDataSyncStoreErrorCode.Unknown;
4343
}
4444

4545
switch (match[1]) {
46-
case RemoteUserDataErrorCode.Rejected: return RemoteUserDataErrorCode.Rejected;
46+
case UserDataSyncStoreErrorCode.Rejected: return UserDataSyncStoreErrorCode.Rejected;
4747
}
4848

49-
return RemoteUserDataErrorCode.Unknown;
49+
return UserDataSyncStoreErrorCode.Unknown;
5050
}
5151

52-
export class RemoteUserDataError extends Error {
52+
export class UserDataSyncStoreError extends Error {
5353

54-
constructor(message: string, public readonly code: RemoteUserDataErrorCode) {
54+
constructor(message: string, public readonly code: UserDataSyncStoreErrorCode) {
5555
super(message);
5656
}
5757

5858
}
5959

60-
export interface IRemoteUserDataProvider {
60+
export interface IUserDataSyncStore {
6161

6262
read(key: string): Promise<IUserData | null>;
6363

6464
write(key: string, content: string, ref: string | null): Promise<string>;
6565

6666
}
6767

68-
export const IRemoteUserDataService = createDecorator<IRemoteUserDataService>('IRemoteUserDataService');
68+
export const IUserDataSyncStoreService = createDecorator<IUserDataSyncStoreService>('IUserDataSyncStoreService');
6969

70-
export interface IRemoteUserDataService {
70+
export interface IUserDataSyncStoreService {
7171

7272
_serviceBrand: undefined;
7373

7474
readonly onDidChangeEnablement: Event<boolean>;
7575

7676
isEnabled(): boolean;
7777

78-
registerRemoteUserDataProvider(name: string, remoteUserDataProvider: IRemoteUserDataProvider): void;
78+
registerUserDataSyncStore(name: string, userDataSyncStore: IUserDataSyncStore): void;
7979

80-
deregisterRemoteUserDataProvider(): void;
80+
deregisterUserDataSyncStore(): void;
8181

8282
getName(): string | null;
8383

0 commit comments

Comments
 (0)