Skip to content

Commit

Permalink
remove user data api implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Sep 18, 2019
1 parent c0072b6 commit 7ccfc2d
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 324 deletions.
55 changes: 0 additions & 55 deletions src/vs/vscode.proposed.d.ts
Expand Up @@ -1089,59 +1089,4 @@ declare module 'vscode' {
}

//#endregion

// #region Sandy - User data synchronization

export namespace window {

/**
* Register an [UserDataSyncProvider](#UserDataSyncProvider) to read and write user data.
* @param name Name of the user data sync provider
* @param userDataSyncProvider [UserDataSyncProvider](#UserDataSyncProvider) to read and write user data
*/
export function registerUserDataSyncProvider(name: string, userDataSyncProvider: UserDataSyncProvider): Disposable;

}

export class UserDataError extends Error {

/**
* Create an error to signal that writing user data with given ref is rejected, becase of new ref.
*/
static Rejected(): FileSystemError;

/**
* Creates a new userData error.
*/
constructor();
}

/**
* User data sync provider to read and write user data.
*/
export interface UserDataSyncProvider {

/**
* Reads the content and its ref for the given key.
* Return <code>null</code> if key does not exists.
*
* @param key key of the content to read
* @returns the content and its ref for the given key. Return <code>null</code> if key does not exists.
*/
read(key: string): Promise<{ content: string, ref: string } | null>;

/**
* Writes the new content based on the given ref for the given key.
*
* @param key key of the content to write
* @param content new content to write
* @param ref ref of the content on which the content to write is based on
* @throws [Rejected](#UserDataError.Rejected) if the ref is not the latest.
* @returns the latest ref of the content.
*/
write(key: string, content: string, ref: string | null): Promise<string>;

}

//#endregion
}
1 change: 0 additions & 1 deletion src/vs/workbench/api/browser/extensionHost.contribution.ts
Expand Up @@ -18,7 +18,6 @@ import './mainThreadCodeInsets';
import './mainThreadClipboard';
import './mainThreadCommands';
import './mainThreadConfiguration';
import './mainThreadUserData';
import './mainThreadConsole';
import './mainThreadDebugService';
import './mainThreadDecorations';
Expand Down
48 changes: 0 additions & 48 deletions src/vs/workbench/api/browser/mainThreadUserData.ts

This file was deleted.

7 changes: 0 additions & 7 deletions src/vs/workbench/api/common/extHost.api.impl.ts
Expand Up @@ -68,7 +68,6 @@ import { ILogService } from 'vs/platform/log/common/log';
import { IURITransformerService } from 'vs/workbench/api/common/extHostUriTransformerService';
import { IExtHostRpcService } from 'vs/workbench/api/common/extHostRpcService';
import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
import { ExtHostUserData } from 'vs/workbench/api/common/extHostUserData';

export interface IExtensionApiFactory {
(extension: IExtensionDescription, registry: ExtensionDescriptionRegistry, configProvider: ExtHostConfigProvider): typeof vscode;
Expand Down Expand Up @@ -125,7 +124,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
const extHostWindow = rpcProtocol.set(ExtHostContext.ExtHostWindow, new ExtHostWindow(rpcProtocol));
const extHostProgress = rpcProtocol.set(ExtHostContext.ExtHostProgress, new ExtHostProgress(rpcProtocol.getProxy(MainContext.MainThreadProgress)));
const extHostLabelService = rpcProtocol.set(ExtHostContext.ExtHosLabelService, new ExtHostLabelService(rpcProtocol));
const extHostUserData = rpcProtocol.set(ExtHostContext.ExtHostUserData, new ExtHostUserData(rpcProtocol.getProxy(MainContext.MainThreadUserData), extHostLogService));

// Check that no named customers are missing
const expected: ProxyIdentifier<any>[] = values(ExtHostContext);
Expand Down Expand Up @@ -545,10 +543,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
},
createInputBox(): vscode.InputBox {
return extHostQuickOpen.createInputBox(extension.identifier);
},
registerUserDataSyncProvider: (name: string, userDataProvider: vscode.UserDataSyncProvider): vscode.Disposable => {
checkProposedApiEnabled(extension);
return extHostUserData.registerUserDataProvider(extension.identifier.value, name, userDataProvider);
}
};

Expand Down Expand Up @@ -907,7 +901,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
CallHierarchyIncomingCall: extHostTypes.CallHierarchyIncomingCall,
CallHierarchyItem: extHostTypes.CallHierarchyItem,
Decoration: extHostTypes.Decoration,
UserDataError: extHostTypes.UserDataError,
WebviewEditorState: extHostTypes.WebviewEditorState,
UIKind: UIKind
};
Expand Down
13 changes: 0 additions & 13 deletions src/vs/workbench/api/common/extHost.protocol.ts
Expand Up @@ -46,7 +46,6 @@ import { ExtensionActivationError } from 'vs/workbench/services/extensions/commo
import { createExtHostContextProxyIdentifier as createExtId, createMainContextProxyIdentifier as createMainId, IRPCProtocol } from 'vs/workbench/services/extensions/common/proxyIdentifier';
import * as search from 'vs/workbench/services/search/common/search';
import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles';
import { IUserData } from 'vs/platform/userDataSync/common/userDataSync';

export interface IEnvironment {
isExtensionDevelopmentDebug: boolean;
Expand Down Expand Up @@ -146,11 +145,6 @@ export interface MainThreadConfigurationShape extends IDisposable {
$removeConfigurationOption(target: ConfigurationTarget | null, key: string, resource: UriComponents | undefined): Promise<void>;
}

export interface MainThreadUserDataShape extends IDisposable {
$registerUserDataProvider(id: string, name: string): void;
$deregisterUserDataProvider(id: string): void;
}

export interface MainThreadDiagnosticsShape extends IDisposable {
$changeMany(owner: string, entries: [UriComponents, IMarkerData[] | undefined][]): void;
$clear(owner: string): void;
Expand Down Expand Up @@ -758,11 +752,6 @@ export interface ExtHostConfigurationShape {
$acceptConfigurationChanged(data: IConfigurationInitData, eventData: IWorkspaceConfigurationChangeEventData): void;
}

export interface ExtHostUserDataShape {
$read(key: string): Promise<IUserData | null>;
$write(key: string, content: string, ref: string): Promise<string>;
}

export interface ExtHostDiagnosticsShape {
$acceptMarkersChange(data: [UriComponents, IMarkerData[]][]): void;
}
Expand Down Expand Up @@ -1336,7 +1325,6 @@ export const MainContext = {
MainThreadCommands: createMainId<MainThreadCommandsShape>('MainThreadCommands'),
MainThreadComments: createMainId<MainThreadCommentsShape>('MainThreadComments'),
MainThreadConfiguration: createMainId<MainThreadConfigurationShape>('MainThreadConfiguration'),
MainThreadUserData: createMainId<MainThreadUserDataShape>('MainThreadUserData'),
MainThreadConsole: createMainId<MainThreadConsoleShape>('MainThreadConsole'),
MainThreadDebugService: createMainId<MainThreadDebugServiceShape>('MainThreadDebugService'),
MainThreadDecorations: createMainId<MainThreadDecorationsShape>('MainThreadDecorations'),
Expand Down Expand Up @@ -1376,7 +1364,6 @@ export const MainContext = {
export const ExtHostContext = {
ExtHostCommands: createExtId<ExtHostCommandsShape>('ExtHostCommands'),
ExtHostConfiguration: createExtId<ExtHostConfigurationShape>('ExtHostConfiguration'),
ExtHostUserData: createExtId<ExtHostUserDataShape>('ExtHostUserData'),
ExtHostDiagnostics: createExtId<ExtHostDiagnosticsShape>('ExtHostDiagnostics'),
ExtHostDebugService: createExtId<ExtHostDebugServiceShape>('ExtHostDebugService'),
ExtHostDecorations: createExtId<ExtHostDecorationsShape>('ExtHostDecorations'),
Expand Down
24 changes: 0 additions & 24 deletions src/vs/workbench/api/common/extHostTypes.ts
Expand Up @@ -14,8 +14,6 @@ import { generateUuid } from 'vs/base/common/uuid';
import * as vscode from 'vscode';
import { FileSystemProviderErrorCode, markAsFileSystemProviderError } from 'vs/platform/files/common/files';
import { RemoteAuthorityResolverErrorCode } from 'vs/platform/remote/common/remoteAuthorityResolver';
import { UserDataSyncStoreErrorCode } from 'vs/platform/userDataSync/common/userDataSync';
import { markAsUserDataSyncStoreError } from 'vs/workbench/services/userDataSync/common/userDataSyncStores';

function es5ClassCompat(target: Function): any {
///@ts-ignore
Expand Down Expand Up @@ -2385,28 +2383,6 @@ export class Decoration {
bubble?: boolean;
}

@es5ClassCompat
export class UserDataError extends Error {

static Rejected(message?: string): UserDataError {
return new UserDataError(message, UserDataSyncStoreErrorCode.Rejected);
}

constructor(message?: string, code: UserDataSyncStoreErrorCode = UserDataSyncStoreErrorCode.Unknown) {
super(message);

// mark the error as user data provider error so that
// we can extract the error code on the receiving side
markAsUserDataSyncStoreError(this, code);

// workaround when extending builtin objects and when compiling to ES5, see:
// https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
if (typeof (<any>Object).setPrototypeOf === 'function') {
(<any>Object).setPrototypeOf(this, UserDataError.prototype);
}
}
}

export enum WebviewEditorState {
Readonly = 1,
Unchanged = 2,
Expand Down
48 changes: 0 additions & 48 deletions src/vs/workbench/api/common/extHostUserData.ts

This file was deleted.

0 comments on commit 7ccfc2d

Please sign in to comment.