From 9f2d08eaa3c588fbdf49b07e394e357addef317b Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Sun, 15 Sep 2019 20:21:36 +0200 Subject: [PATCH] update doc --- src/vs/vscode.proposed.d.ts | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/vs/vscode.proposed.d.ts b/src/vs/vscode.proposed.d.ts index c2c73ff5a2c89..6e19978908a9d 100644 --- a/src/vs/vscode.proposed.d.ts +++ b/src/vs/vscode.proposed.d.ts @@ -1100,12 +1100,20 @@ declare module 'vscode' { export namespace window { - export function registerUserDataSyncProvider(name: string, userDataProvider: UserDataSyncProvider): Disposable; + /** + * 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; /** @@ -1114,10 +1122,29 @@ declare module 'vscode' { 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 null if key does not exists. + * + * @param key key of the content to read + * @returns the content and its ref for the given key. Return null 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; }