Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes required due to TextBuffer.save becoming async in Atom 1.19 #11

Closed
maxbrunsfeld opened this issue Jun 14, 2017 · 2 comments · Fixed by #23
Closed

Changes required due to TextBuffer.save becoming async in Atom 1.19 #11

maxbrunsfeld opened this issue Jun 14, 2017 · 2 comments · Fixed by #23

Comments

@maxbrunsfeld
Copy link

Hi! Thanks for maintaining the tabletopsimulator-lua 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.close
  • TextBuffer.save
  • TextEditor.save
  • Pane.saveItem
  • Pane.saveItemAs
  • Pane.saveActiveItem
  • Pane.saveActiveItemAs
  • Pane.saveItems
  • Workspace.saveActivePaneItem
  • Workspace.saveActivePaneItemAs

Effects on this package

We think this package could be impacted by this upgrade because it calls the changed methods in the following places:

  • TextEditor.save

We found these calls using a regex search, so this list might be incomplete, and it might contain some false positives.

What to do about the change

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:

Please let me know if you have any questions. I would be happy to help!

@onelivesleft
Copy link
Collaborator

onelivesleft commented Jul 17, 2017

What's the simplest way to block until the save is complete?

Answer: await

onelivesleft added a commit to onelivesleft/atom-tabletopsimulator-lua that referenced this issue Aug 2, 2017
onelivesleft added a commit to onelivesleft/atom-tabletopsimulator-lua that referenced this issue Aug 4, 2017
Issue Berserk-Games#11 isn't actually a problem yet because atom is still only on version 1.18.

Amended code to check atom version; when they update to 1.19 we should be covered.
@onelivesleft
Copy link
Collaborator

1.19 is now out, and this issue does indeed screw up the plugin.

@Knils Knils closed this as completed in #23 Aug 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants