danstiner / hfmt

Format Haskell programs. Inspired by the gofmt utility.
MIT License
125 stars 14 forks source link

Fail with non-zero error code when the code contains a syntax error #27

Closed sergey-kintsel closed 6 years ago

sergey-kintsel commented 6 years ago

It is very helpful for editor extensions. Otherwise it's not possible to get whether the command succeeded or not. This is a vs code extension which is based on these changes https://github.com/sergey-kintsel/hfmt-vscode

danstiner commented 6 years ago

This is a great improvement, thanks Sergey! Of course we should fail if a syntax error was encountered. Sorry I didn't see this till yesterday or I would have replied sooner.

Super cool you are putting together a VS Code extension, I'll have to check it out and maybe add a link to it from the README.

There's a couple minor issues with this, but I'll fix them up on master before cutting a release.

  1. The exit code should be 2 for syntax errors to match what I have documented (which is itself based on rustfmt error codes)
  2. I'd like to avoid using sinkList since it will pull all values into memory, which includes every source file as a String in this case.