Closed Anabra closed 6 years ago
Perform refactoring already saves the file. However currently file changes invalidate the undo stack if they are overlapped with the changes that could be undone.
This may change in the future with the integration of the editors history with our refactoring history.
It might be a documentation issue that you did not expect this behavior.
So if I understand correctly there is no difference between Undo and Undo Refactoring on a module level, only on project level. (Since Undo would only revert the changes on the current file, however Undo Refactoring could revert project-level refactorings, such as OrganizeImports).
Is the above explanation correct?
Yes, changes by the tool and by the user are logically the same. They are however implemented differently. Undo is done by the editor and the UndoRefactoring is done by the server on multiple files. It would be nice if we could integrate the two and present them as a unified history to the user, but this may require some tweaking in the editor integration. Now by invalidating the UndoRefactor stack we ensure that UndoRefactoring will not do crazy changes to the file if it was modified since the refactoring is done.
Thank you for the explanation.
Write some code, perform refactoring, save the file. Now "Undo Refactor" will say "Nothing to undo".