standard / atom-standard-formatter

Atom package to format code using Javascript Standard Style.
https://atom.io/packages/standard-formatter
MIT License
35 stars 19 forks source link

formatOnSave requires extra save #56

Open stephenkubovic opened 8 years ago

stephenkubovic commented 8 years ago

55 fixed the package crash on Atom 1.12.x, but it also introduced a bug with the formatOnSave option. Since the transform operation is now async, the save operation saves the untransformed text, and then the text is replaced with the transformed text, resulting in you needing to save a second time.

stephenkubovic commented 8 years ago

I am not sure how to solve this, as the onWillSave callback is called synchronously - there's no way to interrupt the save operation (which is probably a good thing).

jcready commented 8 years ago

The standard-format, semistandard-format, and happiness-format packages all seem to run synchronously. So if you change this.style to one of those instead of standard then the format on save feature should work.

evollu commented 7 years ago

how about just run standard --fix on this file and let the command update file directly? can atom pick up the change from file automatically?

joseluisq commented 7 years ago

:+1:

hutch120 commented 7 years ago

+1 Would be great to see this fixed.

MarceloPrado commented 7 years ago

+1!