Allow elm-format to run even if there are syntax errors
See original GitHub issueSloppily indented parenthesis around a case expression is invalid syntax according to the plugin, but valid according to the compiler:
test maybe =
String.fromInt
(case maybe of
Just _ ->
1
Nothing ->
2
)
What’s annoying is that this blocks elm-format from fixing it.
Also, I think it’d be good if the plugin would attempt to run elm-format even if there’s a syntax error, because some errors can actually be fixed by elm-format.
Invalid indentation, but elm-format fixes it:
type alias Test =
{foo : String}
Elm-format automatically replaces :
with =
test = {foo:"foo"}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
elm-format/CHANGELOG.md at main · avh4/elm-format - GitHub
Detailed error messages for syntax errors have been removed. Use elm make to see a detailed error if elm-format fails. New features: In...
Read more >Jeroen Engels on Twitter: "IntelliJ Elm now runs elm-format ...
IntelliJ Elm now runs elm-format even when there are syntax errors. Here are syntax errors that elm-format fixes for you. Many thanks to....
Read more >Elm Plugin for Visual Studio Code 0.9.0 - Show and Tell
VS Code 1.42.1; Elm Plugin 0.9.0. Problems: module Main exposing (…) was automatically added even if the file had a module line; random...
Read more >Elm VSCode plugin does not format on save - Stack Overflow
Install elm-format. Install the extension Elm Language Support for VSCode, which includes syntax and error highlighting.
Read more >elm-format - Elm Radio
We discuss the core features and philosophy of elm-format, as ... when I run Elm format and if I don't get compiler errors,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The first issue is a dupe of #22, which I have ignored for too long. I’ll prioritize fixing it.
The 2nd and 3rd are both treated as syntax errors by the compiler.
I’m going to rename this issue so that it emphasizes the part about letting elm-format run even if there are syntax errors.
@Herteby agreed. I’ll do the quick fix right now. I don’t think there’s much we can do with nice error output since we can’t get the
--report=json
data passed through from the Elm compiler to elm-format.