atom-standard-formatter icon indicating copy to clipboard operation
atom-standard-formatter copied to clipboard

formatOnSave requires extra save

Open stephenkubovic opened this issue 8 years ago • 6 comments

#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 avatar Nov 12 '16 21:11 stephenkubovic

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).

stephenkubovic avatar Nov 12 '16 21:11 stephenkubovic

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.

jcready avatar Nov 13 '16 17:11 jcready

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?

evollu avatar Dec 06 '16 15:12 evollu

:+1:

joseluisq avatar Jan 11 '17 08:01 joseluisq

+1 Would be great to see this fixed.

hutch120 avatar May 17 '17 01:05 hutch120

+1!

MarceloPrado avatar Jul 16 '17 15:07 MarceloPrado