File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
src/vs/workbench/contrib/bulkEdit/browser Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -255,15 +255,18 @@ class DeleteOperation implements IFileOperation {
255
255
256
256
// read file contents for undo operation. when a file is too large it won't be restored
257
257
let fileContent : IFileContent | undefined ;
258
- const isSizeLimitExceeded = typeof edit . options . maxSize === 'number' && fileStat . size > edit . options . maxSize ;
259
- if ( ! edit . undoesCreate && ! edit . options . folder && ! isSizeLimitExceeded ) {
260
- try {
261
- fileContent = await this . _fileService . readFile ( edit . oldUri ) ;
262
- } catch ( err ) {
263
- this . _logService . error ( err ) ;
258
+ let fileContentExceedsMaxSize = false ;
259
+ if ( ! edit . undoesCreate && ! edit . options . folder ) {
260
+ fileContentExceedsMaxSize = typeof edit . options . maxSize === 'number' && fileStat . size > edit . options . maxSize ;
261
+ if ( ! fileContentExceedsMaxSize ) {
262
+ try {
263
+ fileContent = await this . _fileService . readFile ( edit . oldUri ) ;
264
+ } catch ( err ) {
265
+ this . _logService . error ( err ) ;
266
+ }
264
267
}
265
268
}
266
- if ( ! fileContent || ! isSizeLimitExceeded ) {
269
+ if ( ! fileContentExceedsMaxSize ) {
267
270
undoes . push ( new CreateEdit ( edit . oldUri , edit . options , fileContent ?. value ) ) ;
268
271
}
269
272
}
You can’t perform that action at this time.
0 commit comments