@@ -87,7 +87,7 @@ export abstract class AbstractTextFileService extends Disposable implements ITex
8787 this . lifecycleService . onShutdown ( this . dispose , this ) ;
8888 }
8989
90- //#region text file IO primitives ( read, create, move, delete, update)
90+ //#region text file read / write
9191
9292 async read ( resource : URI , options ?: IReadTextFileOptions ) : Promise < ITextFileContent > {
9393 const content = await this . fileService . readFile ( resource , options ) ;
@@ -143,6 +143,14 @@ export abstract class AbstractTextFileService extends Disposable implements ITex
143143 }
144144 }
145145
146+ async write ( resource : URI , value : string | ITextSnapshot , options ?: IWriteTextFileOptions ) : Promise < IFileStatWithMetadata > {
147+ return this . fileService . writeFile ( resource , toBufferOrReadable ( value ) , options ) ;
148+ }
149+
150+ //#endregion
151+
152+ //#region text file IO primitives (create, move, copy, delete)
153+
146154 async create ( resource : URI , value ?: string | ITextSnapshot , options ?: ICreateFileOptions ) : Promise < IFileStatWithMetadata > {
147155
148156 // before event
@@ -169,24 +177,6 @@ export abstract class AbstractTextFileService extends Disposable implements ITex
169177 return this . fileService . createFile ( resource , toBufferOrReadable ( value ) , options ) ;
170178 }
171179
172- async write ( resource : URI , value : string | ITextSnapshot , options ?: IWriteTextFileOptions ) : Promise < IFileStatWithMetadata > {
173- return this . fileService . writeFile ( resource , toBufferOrReadable ( value ) , options ) ;
174- }
175-
176- async delete ( resource : URI , options ?: { useTrash ?: boolean , recursive ?: boolean } ) : Promise < void > {
177-
178- // before event
179- await this . _onWillRunOperation . fireAsync ( { operation : FileOperation . DELETE , target : resource } , CancellationToken . None ) ;
180-
181- const dirtyFiles = this . getDirtyFileModels ( ) . map ( dirtyFileModel => dirtyFileModel . resource ) . filter ( dirty => isEqualOrParent ( dirty , resource ) ) ;
182- await this . doRevertFiles ( dirtyFiles , { soft : true } ) ;
183-
184- await this . fileService . del ( resource , options ) ;
185-
186- // after event
187- this . _onDidRunOperation . fire ( new FileOperationDidRunEvent ( FileOperation . DELETE , resource ) ) ;
188- }
189-
190180 async move ( source : URI , target : URI , overwrite ?: boolean ) : Promise < IFileStatWithMetadata > {
191181 return this . moveOrCopy ( source , target , true , overwrite ) ;
192182 }
@@ -287,6 +277,20 @@ export abstract class AbstractTextFileService extends Disposable implements ITex
287277 return stat ;
288278 }
289279
280+ async delete ( resource : URI , options ?: { useTrash ?: boolean , recursive ?: boolean } ) : Promise < void > {
281+
282+ // before event
283+ await this . _onWillRunOperation . fireAsync ( { operation : FileOperation . DELETE , target : resource } , CancellationToken . None ) ;
284+
285+ const dirtyFiles = this . getDirtyFileModels ( ) . map ( dirtyFileModel => dirtyFileModel . resource ) . filter ( dirty => isEqualOrParent ( dirty , resource ) ) ;
286+ await this . doRevertFiles ( dirtyFiles , { soft : true } ) ;
287+
288+ await this . fileService . del ( resource , options ) ;
289+
290+ // after event
291+ this . _onDidRunOperation . fire ( new FileOperationDidRunEvent ( FileOperation . DELETE , resource ) ) ;
292+ }
293+
290294 //#endregion
291295
292296 //#region save
0 commit comments