File operation events support multiple resources (#98988)

* refactor: use array of resources

* refactor: use an array of uricomponentspair

* feat: move many resources

* refactor: rename data to files

* feat: use array of files for copy

* refactor: use move with multiple resources

* refactor: use move method with array of files

* refactor: rename data to files

* feat: moveOrCopy array of resources on paste

* refactor: use concise loop syntax

* test: assert number of events

* refactor: rename uricomponentspair

* support multiple files on WorkingCopyFileEvent

* feat: support multiple resources
onWillRunWorkingCopyFIleOperation onDidRunWorkingCopyFileOperation

* refactor: make source optional for consistency

* refactor: support resources for delete

* test: isolate tests

* fix: iterate over resources

* feat: support operations on delete

* feat: adopt deleting multiple resources

* fix: typing and sequential flow of copyservice

* fix: typing and naming

* fix: typing and naming

* fix: use different message for multiple overwrites

* refactor: naming consistency

* fix: use array resources

* fix: message for multiple overwrites

* fix format

* clean up working copy file service

* refactor multiple overwrites message helper

* use openeditors to bulk open

* split drop copy and move

* add returns

Co-authored-by: Benjamin Pasero <benjpas@microsoft.com>
This commit is contained in:
Pascal Fong Kye
2020-06-24 10:32:55 +02:00
committed by GitHub
co-authored by Benjamin Pasero
parent ac314ec9d1
commit e3033faeee
15 changed files with 557 additions and 315 deletions
@@ -57,14 +57,14 @@ export class MainThreadFileSystemEventService {
// BEFORE file operation
workingCopyFileService.addFileOperationParticipant({
participate: (target, source, operation, progress, timeout, token) => {
return proxy.$onWillRunFileOperation(operation, target, source, timeout, token);
participate: (files, operation, progress, timeout, token) => {
return proxy.$onWillRunFileOperation(operation, files, timeout, token);
}
});
// AFTER file operation
this._listener.add(textFileService.onDidCreateTextFile(e => proxy.$onDidRunFileOperation(FileOperation.CREATE, e.resource, undefined)));
this._listener.add(workingCopyFileService.onDidRunWorkingCopyFileOperation(e => proxy.$onDidRunFileOperation(e.operation, e.target, e.source)));
this._listener.add(textFileService.onDidCreateTextFile(e => proxy.$onDidRunFileOperation(FileOperation.CREATE, [{ target: e.resource }])));
this._listener.add(workingCopyFileService.onDidRunWorkingCopyFileOperation(e => proxy.$onDidRunFileOperation(e.operation, e.files)));
}
dispose(): void {