@@ -15,6 +15,7 @@ import { URI } from 'vs/base/common/uri';
1515import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
1616
1717import { ILogService } from 'vs/platform/log/common/log' ;
18+ import { VSBuffer } from 'vs/base/common/buffer' ;
1819
1920interface IFileOperation {
2021 uris : URI [ ] ;
@@ -55,7 +56,7 @@ class CreateOperation implements IFileOperation {
5556 constructor (
5657 readonly newUri : URI ,
5758 readonly options : WorkspaceFileEditOptions ,
58- readonly contents : string | undefined ,
59+ readonly contents : VSBuffer | undefined ,
5960 @IFileService private readonly _fileService : IFileService ,
6061 @ITextFileService private readonly _textFileService : ITextFileService ,
6162 @IInstantiationService private readonly _instaService : IInstantiationService ,
@@ -70,7 +71,6 @@ class CreateOperation implements IFileOperation {
7071 if ( this . options . overwrite === undefined && this . options . ignoreIfExists && await this . _fileService . exists ( this . newUri ) ) {
7172 return new Noop ( ) ; // not overwriting, but ignoring, and the target file exists
7273 }
73- //todo@jrieken , @bpasero allow to accept VSBuffer
7474 await this . _textFileService . create ( this . newUri , this . contents , { overwrite : this . options . overwrite } ) ;
7575 return this . _instaService . createInstance ( DeleteOperation , this . newUri , this . options ) ;
7676 }
@@ -83,7 +83,6 @@ class DeleteOperation implements IFileOperation {
8383 readonly options : WorkspaceFileEditOptions ,
8484 @IWorkingCopyFileService private readonly _workingCopyFileService : IWorkingCopyFileService ,
8585 @IFileService private readonly _fileService : IFileService ,
86- @ITextFileService private readonly _textFileService : ITextFileService ,
8786 @IConfigurationService private readonly _configurationService : IConfigurationService ,
8887 @IInstantiationService private readonly _instaService : IInstantiationService ,
8988 @ILogService private readonly _logService : ILogService ,
@@ -102,9 +101,9 @@ class DeleteOperation implements IFileOperation {
102101 return new Noop ( ) ;
103102 }
104103
105- let contents : string | undefined ;
104+ let contents : VSBuffer | undefined ;
106105 try {
107- contents = ( await this . _textFileService . read ( this . oldUri ) ) . value ;
106+ contents = ( await this . _fileService . readFile ( this . oldUri ) ) . value ;
108107 } catch ( err ) {
109108 this . _logService . critical ( err ) ;
110109 }
0 commit comments