-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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
Undo of rename Java file has no effect #107740
Comments
When you say:
How do you rename the file name? Is there a code action that you do or do you do rename from the explorer? AFAIK the file operations done from the explorer are not undoable (they don't push elements to the undo/redo service). |
The rename is done from the explorer and this triggers a refactoring. |
Closing as dup of #9390 |
Reopening this issue, because it is more scoped and is a good first step for investigation of undo / redo in Explorer |
I know that @bpasero investigated how to use the |
Yeah did not get to actually implementing this, but using bulk edit service over working copy service in explorer makes sense to me. |
👍 It might be good to start only with the case of rename file, because, for example, AFAIK if you create a delete file workspace edit, it will end up reading the file from disk and storing it in memory in order to be able to undo the deletion. Also LMK if you run into undo/redo problems. |
Thanks @alexdima for the heads up. As for storing a file in memory, I guess that is not fine for large files, so could we simply have some limit on the service side? We can discuss more in the standup also. |
Thanks to @jrieken this now works, thus closing. |
Tried in 2020-11-19 insider version, renaming to refactor a Java file from file explorer, undo only roll back the file contents, but not restore the file name. |
@testforstephen I apologize, this should hopefully work with today's insiders from 11-20. |
i tried the insider 11-23 again, here is the result.
It seems that @jrieken's change is for the onWill-file event, but Java extension performs rename refactoring inside the onDidRenameFiles event. We chose the onDidRenameFiles event because the onWillRenameFiles event only gives the extension 5 seconds by default to calculate the refactoring edits. If you're refactoring a large project, it may take more than 5 seconds to calculate refactoring updates. When the timeout occurs, VS Code client will force the files to be renamed to the new location, which will cause the running refactoring job to throw an exception because the underlying files have changed. I created an issue #111208 to discuss about onWillRenameFiles limitation. |
@testforstephen thanks for trying it out and for creating a new issue, let's continue the discussion there, |
Adding on-testplan since there is a related test plan item and this exact case will be verified by #111208 |
Testing #107617
The text was updated successfully, but these errors were encountered: