vscode-reasonml
vscode-reasonml copied to clipboard
Reformatting server breaks in case of large file with a syntax error.
Tried on mac, latest vscode and plugin. Noticed on a real production file of about 1000 lines. Repro: open page.re https://gist.github.com/cristianoc/1b4ab0608ed61958958cdcdbae04113d Reformat, and get error:
events.js:160
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at exports._errnoException (util.js:1022:11)
at WriteWrap.afterWrite [as oncomplete] (net.js:804:14)
[Error - 12:13:30 PM] Connection to server got closed. Server will not be restarted.
Then delete line 4 which has a spurious |
, and try to reformat again. Nothing happens.
A large file is required for the repro.
Related: https://github.com/reasonml-editor/vscode-reasonml/issues/56
I'm having a similar problem. Things were working fine until a couple of days ago; I think vscode got updated at that time. I'm on a Mac, latest vscode and plugin. My file is 576 lines.
I can almost-always reproduce the problem by adding this code near the beginning of my file:
let bullshit = () => {
Js.log("hi")
Js.log("there");
};
(note the missing semicolon)
Here's the message I get in the OUTPUT tab:
events.js:163
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at exports._errnoException (util.js:1050:11)
at WriteWrap.afterWrite [as oncomplete] (net.js:813:14)
[Error - 16:39:42] Connection to server got closed. Server will not be restarted.
Perhaps related, when it doesn't crash, I get TWO notifications of the same error in the PROBLEMS tab.
If I move that code to near the bottom of the file, no crash occurs, even after repeated re-saving of the file with/without the semicolon. The failure seems to be dependent, perhaps, on having lots of code AFTER the missing semicolon.
This is making it pretty tough to use Reason in VSCode on our team, any chance we could get some attention on this ticket? Or pointers for things to look into?
This is making it pretty tough to use Reason in VSCode on our team, any chance we could get some attention on this ticket?
Unfortunately I don't have a lot of free cycles for working on this extension or the server right now. I'm hoping that around August I will start to have more time again and can fix serveral of the outstanding issues like this one.
In the meantime, I'm willing to accept PRs and publish new versions. If you want to try and address this yourself, you might start by looking at the server here, which is where the refmt
process is launched.
Without further investigation, I'm not entirely sure what the cause of this problem is, but you could at least add some sort of error handling around the how the process is executed.