Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Atom Crashes When Trying to Save HTML Files #480

Open
ghost opened this issue Jan 11, 2019 · 13 comments
Open

Atom Crashes When Trying to Save HTML Files #480

ghost opened this issue Jan 11, 2019 · 13 comments
Labels

Comments

@ghost
Copy link

ghost commented Jan 11, 2019

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

@j-f1
Copy link
Member

j-f1 commented Jan 11, 2019

How big is the HTML file you’re saving?

@robwise
Copy link
Collaborator

robwise commented Jan 11, 2019

Also, can you confirm that this works fine outside of prettier-atom (using Pretter directly)?

@ghost
Copy link
Author

ghost commented Jan 14, 2019

How big is the HTML file you’re saving?

It's only 34kb

@ghost
Copy link
Author

ghost commented Jan 14, 2019

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.

@schteff
Copy link

schteff commented Jan 18, 2019

Same for me with a 28kB html. Prettier CLI works fine. I have disabled autoformat for *.html until this is fixed.

@robwise
Copy link
Collaborator

robwise commented Jan 18, 2019

Can someone give me some sample html and filename that fails for them and I can try to reproduce locally?

@schteff
Copy link

schteff commented Jan 18, 2019

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)

@davidmwhynot
Copy link

I am experiencing this issue still with the following html file: index.html gist

@Benjamin-Lee
Copy link

Can confirm. Tried saving a file with 200 lines of SVG inline and it consistently crashed my editor.

@miloxeon
Copy link

Me too

@robwise
Copy link
Collaborator

robwise commented Oct 25, 2019

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

@miloxeon
Copy link

@robwise https://miloslav.website, index.html

@robwise
Copy link
Collaborator

robwise commented Oct 28, 2019

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: prettier/prettier#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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants