nboldi / haskell-tools-atom

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

Can't refactor when the file is in unsaved state. #38

Closed Anabra closed 6 years ago

Anabra commented 6 years ago

Cannot perform refactoring after modifying the file but not saving it.

nboldi commented 6 years ago

Haskell-tools does not recognize a change until you save the file.

This might be uncomfortable for users. Do you think a popup asking if you want to save the file before refactoring should be useful?

Anabra commented 6 years ago

In my opinion a pop-up would be annoying. I think there should an option for this in the settings menu. Also there should be some short explanation under that option, why this is needed.

"Automatically save the file before refactoring" checkbox -- By turning this option on, you can perform refactorings on an unsaved file.

Honestly, that should be the default behaviour, so we wouldn't have to explain it to users. My suggestion is that enable auto-saving by default, and give the users an option to disable it:

"Disable auto-saving before refactoring" checkbox -- If you disable auto-saving, you can't refactor unsaved files.

By implementing this behaviour, the extra pop-up message seems more useful. So if the user disabled auto-saivng, and tries to refactor an unsaved file, give them a message saying that:

"Can't refactor unsaved files. Turn-on auto-saving to enable it."

nboldi commented 6 years ago

Check out the latest commit: https://github.com/nboldi/haskell-tools-atom/commit/22ec75e7ee811c4997625a86ca6636c4d335748e

Anabra commented 6 years ago

Works perfectly.