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

Rename (refactoring) works even though methods are unsaved #2821

Open
fuhrmanator opened this Issue Mar 14, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@fuhrmanator
Copy link

fuhrmanator commented Mar 14, 2019

I was modifying a method (methodA) and decided one of the calls to another method (methodB) could have a better name. So I spontaneously did rename by right-clicking on methodB and renamed it to methodC. The rename worked, but it modified (and saved) methodA which I was already modifying. The editor then shows the red corner to say the method was modified elsewhere. Yes, technically I allowed it, but I was unaware of the negative consequence.

The workaround (to not lose data) is to paste the still-open copy of methodA into another editor (playground) and cancel, then try to figure out the differences between the rename and what was already changed (or to save that copy and rename methodB to methodC manually within methodA).

A great solution (used in other IDEs) is simply to disallow the refactoring (e.g., the rename) if any methods (especially ones that will be affected) are unsaved. In my case, I would have happily saved the edit of methodA before applying the rename, or waited until I was done with the edit.

@dionisiydk

This comment has been minimized.

Copy link
Contributor

dionisiydk commented Mar 14, 2019

@fuhrmanator

This comment has been minimized.

Copy link
Author

fuhrmanator commented Mar 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.