jscheid / prettier.el

Prettier code formatting for Emacs.
GNU General Public License v3.0
168 stars 12 forks source link

Hangs with output C-1 #62

Closed jscheid closed 3 years ago

jscheid commented 3 years ago

Prettier.el can get into a broken state sometimes, where all operations hang. This is what's in *prettier (local)*.

C-1
Z0

I think the problem here is that result["cursorOffset"] can be negative which then breaks the response parsing in prettier.el. We should probably ignore negative offsets and not send the C line at all.

I haven't been able to reproduce this reliably so far, but it did happen a couple of times to me, once in a tsconfig.json file and once in a Java source file.

MarcusRiemer commented 3 years ago

Thanks for fixing this, I just stumbled over the problem yesterday and wanted to open an issue. I can confirm that this fix works for me as well.