Skip to content
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

Support file operations (create, rename, delete) in cross file undo #91383

Closed
jrieken opened this issue Feb 25, 2020 · 5 comments
Closed

Support file operations (create, rename, delete) in cross file undo #91383

jrieken opened this issue Feb 25, 2020 · 5 comments
Assignees
Labels
feature-request Request for new features or functionality undo-redo Issues around undo/redo verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@jrieken
Copy link
Member

jrieken commented Feb 25, 2020

re #91248

This is a feature request (or request for complete feature) so that things like "Java-class rename" or "TS extract to new file" refactorings can be undone safely

@alexdima alexdima added the feature-request Request for new features or functionality label Feb 26, 2020
@alexdima alexdima added this to the Backlog milestone Feb 26, 2020
@alexdima alexdima added the undo-redo Issues around undo/redo label Feb 26, 2020
@alexdima alexdima removed their assignment Feb 26, 2020
@alexdima alexdima changed the title Support file operations (create, rename, delete) in x-file undo Support file operations (create, rename, delete) in cross file undo Feb 26, 2020
@jrieken jrieken self-assigned this Jun 15, 2020
@jrieken jrieken modified the milestones: Backlog, June 2020 Jun 15, 2020
jrieken added a commit that referenced this issue Jun 22, 2020
create separate files for text and file operation
jrieken added a commit that referenced this issue Jun 23, 2020
@jrieken
Copy link
Member Author

jrieken commented Jun 24, 2020

I have enabled undo for rename operations. What's still missing

  • file and text undo element aren't connected yet, e.g TypeScript's "Move to new file" or the Java class rename, need two undos
  • undo is always driven by the active editor which means delete file has no "UX hook" for its undo operation

@jrieken jrieken closed this as completed Jun 30, 2020
@jrieken jrieken added the verification-needed Verification of issue is requested label Jun 30, 2020
@jrieken
Copy link
Member Author

jrieken commented Jun 30, 2020

To verify:

  • have a Java project
  • rename (F2) a class name so that its file name changes
  • press undo two times and make sure every thing is bad to normal
  • do the same with TypeScript and "move to new file"

Note the comment above with means two undos, one for textual and for file operations, are needed. This is temporary!

@connor4312 connor4312 added the verified Verification succeeded label Jul 1, 2020
@connor4312
Copy link
Member

Java works fine, but for TS:

  1. Create x.ts with function foo() {}
  2. Refactor foo and move to new file. It moves it to a new foo.ts file ✔️
  3. Undo it. Accept Undo in 2 Files
  4. The function is copied back to x.ts, but foo.ts still exists 🐛

@connor4312 connor4312 reopened this Jul 1, 2020
@jrieken
Copy link
Member Author

jrieken commented Jul 2, 2020

The function is copied back to x.ts, but foo.ts still exists

Yeah, that's expected. You need another undo inside the foo.ts files. That should delete it. The issue is that there are two operations that aren't linked together: a textual operation spanning two files, and a file create operation. Because both aren't "connected" undoing in x.ts only undos the textual operation, unding in foo.ts will undo the file operation.

What puzzles me is how you got the notification about foo.ts being modified on disk?

@connor4312
Copy link
Member

connor4312 commented Jul 2, 2020

One thing is that I have the prettier extension installed. All of my "Format On *" options are turned off, but I noticed that if I type

function foo() {}

The function in the moved file is

function foo() { } // <- with a space

Which looks like formatting happened at some point.

I will remove the verified tag and let someone else take a shot at this.

@connor4312 connor4312 added verified Verification succeeded and removed verified Verification succeeded labels Jul 2, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Aug 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality undo-redo Issues around undo/redo verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants