Closed jscheid closed 3 years ago
I couldn't reproduce the case (the remote process getting stuck) so I've tested this PR inserting for (;;) {}
before prettier.format
. And it works.
Thanks for taking a look. To reproduce:
(cd test-cases/ruby-mode-error && npm install)
(don't use yarn, as it won't pick up package-lock.json
and instead install a newer version of @prettier/plugin-ruby
which doesn't print to stderr anymore.)test-cases/ruby-mode-error/a.original.rb
and M-x prettier-restart
(for good measure), M-x prettier-prettify
-- it should hang indefinitely using latest released prettier.el
I'll leave this open for another couple of days in case you get a chance to take another look, but don't feel obliged. I've been dogfooding this over the course of the week and seems to work as expected.
Print a beacon string at the beginning of the response and skip to it when reading the response.
This avoids communication with the remote process getting stuck in cases where calling
prettier.format
emits anything to stdout/stderr, as is the case with @prettier/plugin-ruby at least up to version 1.5.2.Also, handle remote process timeouts better.