Hi! Thanks for maintaining the atom-beautify package!
In Atom v1.19, we will release a major change to Atom's core text buffer data structure. As part of this change, we have made TextBuffer.save asynchronous; rather than blocking until the save is complete, it now immediately returns a Promise that resolves when the save is complete. Because of this, a few other Atom APIs that use save have similarly become async:
Pane.closeTextBuffer.saveTextEditor.savePane.saveItemPane.saveItemAsPane.saveActiveItemPane.saveActiveItemAsPane.saveItemsWorkspace.saveActivePaneItemWorkspace.saveActivePaneItemAsWe think this package could be impacted by this upgrade because it calls the changed methods in the following places:
TextEditor.saveWe found these calls using a regex search, so this list might be incomplete, and it might contain some false positives.
It should be pretty easy to adjust your package code and/or tests to work with the new async behavior, and to simultaneously keep it working with older versions of Atom. Here are some examples of pull requests we opened on our bundled packages to cope with the change:
I tried this out using 1.19 beta 5 and can confirm this needs a patch. The TextEditor.save() call being made in beautify.coffee is infinite when doing beautify on save, and makes the file virtually unmaintainable until you manually force the process to end. Will take a look at this later today.
@Glavin001 I see you had posted a question on the Atom discussion board around preventing the editor from saving before beautification has completed when Beautify on Save is checked. Did you have any thoughts on how you wanted to fix that TextEditor.save() will be async?
I am currently away on vacation until August 17th. However, if someone can submit a Pull Request I will try to review and merge this weekend when I have slightly better Internet connectivity than 1 bar cell phone service. Thanks in advance!
Published to v0.30.5
Most helpful comment
Published to v0.30.5