Repository navigation
Wait for promises returned by onWillSave handlers before saving - #254
Conversation
|
Hi @maxbrunsfeld, does the promise simply need to be returned or does it have to be resolved? I'm finding that returned rejected promises it's not saving the content of the buffer, though coffeescript isn't my favorite thing and could be a coding issue. Also looking at the docs here: https://atom.io/docs/api/v1.21.1/TextBuffer#instance-onWillSave it does say it will not save until the promise is resolved. |
|
We will now wait until promises returned from ‘onWillSave’ listeners to resolve before saving the file. If the listeners return a promise that rejects, then ‘buffer.save’ will reject with that error, and the file will not be saved. |
|
OK thanks, one more question. Is it possible to get the file path, or at least the file name and extension, after the save prompt for a file that hasn't been saved yet during onWillSave? Basically:
That all occurs before any onWillSave code is run, but I can't find any reference to what the user puts in there. |
|
Hmm, I don't think you can access that data currently. It would be possible to add it as an argument to the |
|
I could try, I've never looked at this code before nor actually built Atom locally. |
Refs atom/event-kit#36