Vscode: Support multiple files in working copy file service

Created on 21 May 2020  路  8Comments  路  Source: microsoft/vscode

When dragging multiple files in the explorer, the onWillRenameFiles event is fired multiple times concurrently with a single file per-call - even though the API supports an array:

https://github.com/microsoft/vscode/blob/926fc23f139e4d1250dba494c6e825e4816e62f6/src/vs/workbench/api/common/extHostFileSystemEventService.ts#L185

This means an extension will produce multiple edits for a single operation if there are multiple files moved - though it looks like VS Code merges them together:

https://github.com/microsoft/vscode/blob/926fc23f139e4d1250dba494c6e825e4816e62f6/src/vs/workbench/api/common/extHostFileSystemEventService.ts#L219-L228

However, this fails if two of the edits modified the same file with "(file) has changed in the meantime".

Here's a gif showing individual file moves correctly updating the file on the right. However if I moved them both at the same time, only one edit is applied and the other one fails.

multi_rename_fails2

The code for that repro is available here:

https://github.com/DanTup/vscode-repro-will-rename-files (extension.ts).

feature-request file-io help wanted insiders-released on-release-notes on-testplan verified

Most helpful comment

Hi @bpasero
I would like to work on this issue if nobody else is.

All 8 comments

@bpasero, @isidorn Not sure if the working-copy service still needs support for this or if the explorer didn't adopt this yet

@jrieken I was not aware there is support for an array of resources, e.g. when I look at $onWillRunFileOperation and $onDidRunFileOperation I can only pass in a single resource. But it would probably be easy enough to support an array here given the ext host side supports an array for the event.

This needs:

  • support on the working copy file service to do operations on multiple resources
  • adoption in places where we want to support this (e.g. explorer)

Setting help wanted if someone wants to do this, shouldn't be too complicated.

Hi @bpasero
I would like to work on this issue if nobody else is.

Yes, go for it 馃憤

@bpasero I see you are reviewing this. Feel free to assign me back if you need some help.

@DanTup can you please verify your original issue is resolved with your test extension?

Yes, this works! Thank you @pfongkye @bpasero! 馃榾

Yes, this works! Thank you @pfongkye @bpasero!

Great 馃槂
You're welcome.

Was this page helpful?
0 / 5 - 0 ratings