From 754875a9867aaba18e248d79845c32094d5a7349 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 19 Feb 2020 13:38:22 +0100 Subject: [PATCH] explorer - no need to revert before using working copy file service --- .../workbench/contrib/files/browser/fileActions.ts | 1 - .../contrib/files/browser/views/explorerViewer.ts | 14 ++------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/vs/workbench/contrib/files/browser/fileActions.ts b/src/vs/workbench/contrib/files/browser/fileActions.ts index 9b527817332..93fc4f9c5d9 100644 --- a/src/vs/workbench/contrib/files/browser/fileActions.ts +++ b/src/vs/workbench/contrib/files/browser/fileActions.ts @@ -183,7 +183,6 @@ async function deleteFiles(workingCopyService: IWorkingCopyService, workingCopyF confirmed = false; } else { skipConfirm = true; - await Promise.all(dirtyWorkingCopies.map(dirty => dirty.revert())); } } diff --git a/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts b/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts index ff97dc81a12..9ae1935e2cd 100644 --- a/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts +++ b/src/vs/workbench/contrib/files/browser/views/explorerViewer.ts @@ -55,7 +55,6 @@ import { ILabelService } from 'vs/platform/label/common/label'; import { isNumber } from 'vs/base/common/types'; import { domEvent } from 'vs/base/browser/event'; import { IEditableData } from 'vs/workbench/common/views'; -import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService'; export class ExplorerDelegate implements IListVirtualDelegate { @@ -643,8 +642,7 @@ export class FileDragAndDrop implements ITreeDragAndDrop { @IInstantiationService private instantiationService: IInstantiationService, @IWorkingCopyFileService private workingCopyFileService: IWorkingCopyFileService, @IHostService private hostService: IHostService, - @IWorkspaceEditingService private workspaceEditingService: IWorkspaceEditingService, - @IWorkingCopyService private workingCopyService: IWorkingCopyService + @IWorkspaceEditingService private workspaceEditingService: IWorkspaceEditingService ) { this.toDispose = []; @@ -945,15 +943,7 @@ export class FileDragAndDrop implements ITreeDragAndDrop { const sourceFile = resource; const targetFile = joinPath(target.resource, basename(sourceFile)); - // if the target exists and is dirty, make sure to revert it. otherwise the dirty contents - // of the target file would replace the contents of the added file. since we already - // confirmed the overwrite before, this is OK. - if (this.workingCopyService.isDirty(targetFile)) { - await Promise.all(this.workingCopyService.getWorkingCopies(targetFile).map(workingCopy => workingCopy.revert({ soft: true }))); - } - - const copyTarget = joinPath(target.resource, basename(sourceFile)); - const stat = await this.workingCopyFileService.copy(sourceFile, copyTarget, true); + const stat = await this.workingCopyFileService.copy(sourceFile, targetFile, true); // if we only add one file, just open it directly if (resources.length === 1 && !stat.isDirectory) { this.editorService.openEditor({ resource: stat.resource, options: { pinned: true } }); -- GitLab