@@ -1100,12 +1100,20 @@ declare module 'vscode' {
11001100
11011101 export namespace window {
11021102
1103- export function registerUserDataSyncProvider ( name : string , userDataProvider : UserDataSyncProvider ) : Disposable ;
1103+ /**
1104+ * Register an [UserDataSyncProvider](#UserDataSyncProvider) to read and write user data.
1105+ * @param name Name of the user data sync provider
1106+ * @param userDataSyncProvider [UserDataSyncProvider](#UserDataSyncProvider) to read and write user data
1107+ */
1108+ export function registerUserDataSyncProvider ( name : string , userDataSyncProvider : UserDataSyncProvider ) : Disposable ;
11041109
11051110 }
11061111
11071112 export class UserDataError extends Error {
11081113
1114+ /**
1115+ * Create an error to signal that writing user data with given ref is rejected, becase of new ref.
1116+ */
11091117 static Rejected ( ) : FileSystemError ;
11101118
11111119 /**
@@ -1114,10 +1122,29 @@ declare module 'vscode' {
11141122 constructor ( ) ;
11151123 }
11161124
1125+ /**
1126+ * User data sync provider to read and write user data.
1127+ */
11171128 export interface UserDataSyncProvider {
11181129
1130+ /**
1131+ * Reads the content and its ref for the given key.
1132+ * Return <code>null</code> if key does not exists.
1133+ *
1134+ * @param key key of the content to read
1135+ * @returns the content and its ref for the given key. Return <code>null</code> if key does not exists.
1136+ */
11191137 read ( key : string ) : Promise < { content : string , ref : string } | null > ;
11201138
1139+ /**
1140+ * Writes the new content based on the given ref for the given key.
1141+ *
1142+ * @param key key of the content to write
1143+ * @param content new content to write
1144+ * @param ref ref of the content on which the content to write is based on
1145+ * @throws [Rejected](#UserDataError.Rejected) if the ref is not the latest.
1146+ * @returns the latest ref of the content.
1147+ */
11211148 write ( key : string , content : string , ref : string | null ) : Promise < string > ;
11221149
11231150 }
0 commit comments