nboldi / haskell-tools-atom

An Atom editor binding for the Haskell-tools framework
7 stars 2 forks source link

Can't undo refactoring after saving the file. #36

Closed Anabra closed 6 years ago

Anabra commented 6 years ago

Write some code, perform refactoring, save the file. Now "Undo Refactor" will say "Nothing to undo".

nboldi commented 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.

Anabra commented 6 years ago

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?

nboldi commented 6 years ago

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.

Anabra commented 6 years ago

Thank you for the explanation.