Skip to content

Commit 37249cb

Browse files
authored
edits - better fix microsoft#236984 (microsoft#237685)
Restore the semantics of how it used to be in before the change in microsoft#144890
1 parent 9409b89 commit 37249cb

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/vs/workbench/contrib/bulkEdit/browser/bulkFileEdits.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,18 @@ class DeleteOperation implements IFileOperation {
255255

256256
// read file contents for undo operation. when a file is too large it won't be restored
257257
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+
}
264267
}
265268
}
266-
if (!fileContent || !isSizeLimitExceeded) {
269+
if (!fileContentExceedsMaxSize) {
267270
undoes.push(new CreateEdit(edit.oldUri, edit.options, fileContent?.value));
268271
}
269272
}

0 commit comments

Comments
 (0)