prettier-atom
prettier-atom copied to clipboard
Atom Crashes When Trying to Save HTML Files
I'm using Atom 1.34.0 on Windows 10 and I had configured Prettier to format on-save. It works fine on javascript files but when I try to save HTML files, it hangs and I have to force close the app.
I know that Prettier is the problem because once I disabled it, the HTML file saved no problem.
How can I go about fixing this? The package version of prettier-atom is 0.56.2
How big is the HTML file you’re saving?
Also, can you confirm that this works fine outside of prettier-atom (using Pretter directly)?
How big is the HTML file you’re saving?
It's only 34kb
Also, can you confirm that this works fine outside of prettier-atom (using Pretter directly)?
I ran Prettier from the CLI and it worked perfectly.
Same for me with a 28kB html. Prettier CLI works fine. I have disabled autoformat for *.html until this is fixed.
Can someone give me some sample html and filename that fails for them and I can try to reproduce locally?
I started out by modifying this template: https://onepagelove.com/evelyn
evelyn.zip test with the index.html
I have redone most of it on my own but I have never been able to format it with prettier in Atom. (prettier CLI works fine)
I am experiencing this issue still with the following html file: index.html gist
Can confirm. Tried saving a file with 200 lines of SVG inline and it consistently crashed my editor.
Me too
@uyouthe Can you provide a gist if possible? I'm not sure what the common thread here is, but it seems to be based on the actual code in the file and very rare. I want to see if there's something obvious about what's going on.
@robwise https://miloslav.website, index.html
Awesome, I think I've narrowed down the issue. When calling prettier.formatWithCursor
, prettier has an out of memory error.
It is this old issue here: https://github.com/prettier/prettier/issues/4801
While we wait for Prettier to fix it, what I suggest you do is run prettier from the command line to format the file the first time. This uses the normal (as opposed to formatWithCursor
) method so it shouldn't crash. From then on, the diff should be much more manageable for Prettier and you shouldn't have the issue again and you can just use prettier-atom as normal.