-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should send a single FileWillRenameEvent instead of separate events when moving multiple files at once #111867
Comments
Very good find. We have this loop which goes over all resource edits and instead of the going one-by-one it should create buckets of equal operation types (likely without changing the order) and then apply a bucket at once |
This needs support from the working copy service. For instance, delete only supports a single options bag but multiple resources. Today, we ask the file- & config-service for a single resource whether to use trash or not but I don't see how that's possible with different resources from potentially different schemes/providers. There are similar issues with copying multiple files but using different |
@isidorn let me know if you are interested in a PR to change the working copy file service to support options per resource. I think the support for bulk came in later (via a PR) but we should have also allowed the options to be specified per resource. Instead of adding another options array I would probably just allow to pass in resource and options in one object. Overall this is not a big change glancing at the existing code, shouldn't be hard. |
@bpasero yeah, I can look into a PR. Will do it early next week. |
@isidorn can you ping when you have done that PR |
Will do, started to look into it now... |
Is this done? |
Nope |
…andle multiple files at once, #111867
@isidorn I am confused why creating doesn't support multiple resources at once while everything else does. Like, undoing a "multi delete" is now separate create operations |
@jrieken originally I did the create to support multiple resources, however after discussion with @bpasero I reverted back to only support a single operation. I can move back to multi operation support. Though let's see if @bpasero is fine with that |
I have no feelings either way is fine for me. |
Okey so I will bring back the support for multi create. I will push directly to master and ping you Ben on the commit. |
Thanks @isidorn. I am almost done with the adoption |
@isidorn checked out the change, it seems that the API now allows for multiple create operations, but within, we are not wiring this in properly (I think that was my initial feedback too that made us go back to supporting just 1 operation). Specifically, shouldn't we use the array of things to create when passing on to the participants and eventing:
Maybe @jrieken can clarify if this kind of change is still needed or not. |
Yes - the event should be fired for many resources. There is a skipped/failing test here: vscode/extensions/vscode-api-tests/src/singlefolder-tests/workspace.test.ts Lines 1008 to 1009 in 0cb7dad
|
Closing. This is now done. @testforstephen please try this out with next insiders. Thanks |
I have played with the insider on 2021-01-08, moving multiple files will be grouped to one FileWillRenameEvent, which works well for me. Thanks for this great fix. |
Thanks a lot for trying it out. Adding verified label based on your comment. |
Currently, if I drag and drop multiple files to a new location at once, the VS Code File Event API
workspace.onWillRenameFiles
will send a separate FileWillRenameEvent for each file to be moved. If i choose to use FileWillRenameEvent.waitUtil() to return the refactored edit, that means each event will return a separate edit and the client will call the applyEdit operation multiple times. This is inconvenient for undo operation.It's better to send a single FileWillRenameEvent instead of separate events when moving multiple files at once.
The text was updated successfully, but these errors were encountered: