From 10e40063d9d98a0dd09945cf3e310401c69ea2ce Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 10 Dec 2020 16:48:48 +0100 Subject: [PATCH] Delete is no longer irreverisible #111636 --- src/vs/workbench/contrib/files/browser/fileActions.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/contrib/files/browser/fileActions.ts b/src/vs/workbench/contrib/files/browser/fileActions.ts index 46aacd31f37..23079af7ec8 100644 --- a/src/vs/workbench/contrib/files/browser/fileActions.ts +++ b/src/vs/workbench/contrib/files/browser/fileActions.ts @@ -168,6 +168,9 @@ async function deleteFiles(explorerService: IExplorerService, workingCopyFileSer } let confirmation: IConfirmationResult; + // We do not support undo of folders, so in that case the delete action is irreversible + const deleteDetail = distinctElements.some(e => e.isDirectory) ? nls.localize('irreversible', "This action is irreversible!") : + distinctElements.length > 1 ? nls.localize('restorePlural', "You can restore these files using the Undo command") : nls.localize('restore', "You can restore this file using the Undo command"); // Check if we need to ask for confirmation at all if (skipConfirm || (useTrash && configurationService.getValue(CONFIRM_DELETE_SETTING_KEY) === false)) { @@ -199,7 +202,7 @@ async function deleteFiles(explorerService: IExplorerService, workingCopyFileSer else { let { message, detail } = getDeleteMessage(distinctElements); detail += detail ? '\n' : ''; - detail += nls.localize('irreversible', "This action is irreversible!"); + detail += deleteDetail; confirmation = await dialogService.confirm({ message, detail, @@ -234,7 +237,7 @@ async function deleteFiles(explorerService: IExplorerService, workingCopyFileSer let primaryButton: string; if (useTrash) { errorMessage = isWindows ? nls.localize('binFailed', "Failed to delete using the Recycle Bin. Do you want to permanently delete instead?") : nls.localize('trashFailed', "Failed to delete using the Trash. Do you want to permanently delete instead?"); - detailMessage = nls.localize('irreversible', "This action is irreversible!"); + detailMessage = deleteDetail; primaryButton = nls.localize({ key: 'deletePermanentlyButtonLabel', comment: ['&& denotes a mnemonic'] }, "&&Delete Permanently"); } else { errorMessage = toErrorMessage(error, false); -- GitLab