Skip to content

Commit

Permalink
Redo is a no-op after undo of file creation (fix microsoft#236984) (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero authored Jan 10, 2025
1 parent 2b4d91e commit 672240b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/vs/workbench/contrib/bulkEdit/browser/bulkFileEdits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,16 @@ class DeleteOperation implements IFileOperation {

// read file contents for undo operation. when a file is too large it won't be restored
let fileContent: IFileContent | undefined;
if (!edit.undoesCreate && !edit.options.folder && !(typeof edit.options.maxSize === 'number' && fileStat.size > edit.options.maxSize)) {
const isSizeLimitExceeded = typeof edit.options.maxSize === 'number' && fileStat.size > edit.options.maxSize;
if (!edit.undoesCreate && !edit.options.folder && !isSizeLimitExceeded) {
try {
fileContent = await this._fileService.readFile(edit.oldUri);
} catch (err) {
this._logService.error(err);
}
}
if (fileContent !== undefined) {
undoes.push(new CreateEdit(edit.oldUri, edit.options, fileContent.value));
if (!fileContent || !isSizeLimitExceeded) {
undoes.push(new CreateEdit(edit.oldUri, edit.options, fileContent?.value));
}
}

Expand Down

0 comments on commit 672240b

Please sign in to comment.