未验证 提交 a4e4e7ed 编写于 作者: I Isidor Nikolic 提交者: GitHub

Merge pull request #111013 from microsoft/isidor/doNotUseTrashFlag

bulkFileEdits: doNotUseTrash flag
......@@ -1387,6 +1387,7 @@ export interface WorkspaceFileEditOptions {
recursive?: boolean;
copy?: boolean;
folder?: boolean;
skipTrashBin?: boolean;
maxSize?: number;
}
......
......@@ -6269,6 +6269,7 @@ declare namespace monaco.languages {
recursive?: boolean;
copy?: boolean;
folder?: boolean;
skipTrashBin?: boolean;
maxSize?: number;
}
......
......@@ -166,13 +166,13 @@ class DeleteOperation implements IFileOperation {
let fileContent: IFileContent | undefined;
if (!this._undoesCreateOperation && !this.options.folder) {
try {
fileContent = (await this._fileService.readFile(this.oldUri));
fileContent = await this._fileService.readFile(this.oldUri);
} catch (err) {
this._logService.critical(err);
}
}
const useTrash = this._fileService.hasCapability(this.oldUri, FileSystemProviderCapabilities.Trash) && this._configurationService.getValue<boolean>('files.enableTrash');
const useTrash = !this.options.skipTrashBin && this._fileService.hasCapability(this.oldUri, FileSystemProviderCapabilities.Trash) && this._configurationService.getValue<boolean>('files.enableTrash');
await this._workingCopyFileService.delete([this.oldUri], { useTrash, recursive: this.options.recursive, ...this.undoRedoInfo });
if (typeof this.options.maxSize === 'number' && fileContent && (fileContent?.size > this.options.maxSize)) {
......
......@@ -226,8 +226,7 @@ async function deleteFiles(explorerService: IExplorerService, bulkEditService: I
// Call function
try {
const resourceFileEdits = distinctElements.map(e => new ResourceFileEdit(e.resource, undefined, { recursive: true, folder: e.isDirectory }));
// TODO@Isidor respect the useTrash parameter
const resourceFileEdits = distinctElements.map(e => new ResourceFileEdit(e.resource, undefined, { recursive: true, folder: e.isDirectory, skipTrashBin: !useTrash }));
await bulkEditService.apply(resourceFileEdits, {
undoRedoSource: explorerService.undoRedoSource,
label: distinctElements.length > 1 ? nls.localize('deleteBulkEdit', "Delete {0} files", distinctElements.length) : nls.localize('deleteFileBulkEdit', "Delete {0}", distinctElements[0].name)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册