Closed feature closed 6 years ago
I'll have to look into why we're showing it twice like that, the applicable code is here https://github.com/Glavin001/atom-beautify/blob/master/src/beautify.coffee#L68-L74, where detail
is being set to error.message
since error.description
is undefined in this case.
As for the special characters, @avh4 is it possible to get a "clean" error without the ANSI color codes from the text stream from elm-format?
So elm-format currently either can format the file or it cannot. If it cannot, then the best way to get the correct syntax error is to run elm-make. (Is it possible that the OP also has a plugin that runs elm-make? In which case, maybe one of the duplicate errors is coming from that plugin.) elm-make has a --report=json
flag that can provide a machine-readable version of the syntax error.
elm-format itself doesn't currently have a way to get the errors in another format. I did notice the npm package strip-ansi which might be an easy way to strip that out (and is only about 4 lines of code to copy in if you don't want to add an npm dependency).
Improving the error reporting flexibility of elm-format is low on my priority list, and probably won't happen in the next version unless I get a contributor who wants to focus on that (there's also some prep work that needs to be done before that sort of work could start).
@avh4 Thanks. The duplicate error has nothing to do with elm-format, that's an Atom Beautify thing. I'll look into strip-ansi.
This issue has been automatically marked as stale because it has not had recent activity. If this is still an issue, please add a comment. It will be closed if no further activity occurs. Thank you for your contributions.
Description
When you try to beautify invalid Elm code, the error output will display odd symbols, and the error message is displayed twice, in the same error pane.
Input Before Beautification
This code is taken from https://guide.elm-lang.org/architecture/user_input/buttons.html I've modified the code, so the
view
function has an invalid type annotation, to cause the beautification to fail.Expected Output
I expected the error look something like this (terminal): https://i.imgur.com/OWAtsV8.png
Actual Output
The error dialog displayed by Atom-Beautify: https://i.imgur.com/JrsHlpt.png
Steps to Reproduce
Atom Beautify: Beautify Editor
Checklist
I have:
Atom Beautify: Help Debug Editor
command in Atom and added link fordebug.md
Gist to this issue