提交 9f2d08ea 编写于 作者: S Sandeep Somavarapu

update doc

上级 3fe9a423
......@@ -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 <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>;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册