Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Sep 15, 2019
1 parent 3fe9a42 commit 9f2d08e
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/vs/vscode.proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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 <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>;

}
Expand Down

0 comments on commit 9f2d08e

Please sign in to comment.