mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 21:55:38 +00:00
update doc
This commit is contained in:
parent
3fe9a42331
commit
9f2d08eaa3
29
src/vs/vscode.proposed.d.ts
vendored
29
src/vs/vscode.proposed.d.ts
vendored
|
@ -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>;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue