Closed 64kramsystem closed 5 years ago
AFC will now perform a save. This is unnnecessary, since no changes have been made to the document.
The plugin saves the state on close because Sublime Text has a "hot exit" feature (ie: if you close a project window with unsaved buffers, then the files are not saved but the state is saved in Sublime Text itself).
Listening on close means that folds in this case are preserved, since if it only listened on save then it would fail to remember these code folds.
This is fixed by #11
AFC currently listens on two events related to save:
Based on a generic understanding of the code, it's not clear why the close event should be listened to, since the act of closing a document itself is unrelated to the act of saving it. Listening on saves should be a guarantee on itself that the AFC state persistence is in sync with the corresponding document.
There are two main cases where this applies (I'm opening a separate issue for a bug caused by this), one of whom is:
AFC will now perform a save. This is unnnecessary, since no changes have been made to the document.
Since I'm not familiar with the ST3 event system, it's possible that there are cases where the close event should be listened to, however, I think they're not obvious, so in this case, it would make the code more understandable if a documentating comment would be added to the
on_close
method.