question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow elm-format to run even if there are syntax errors

See original GitHub issue

Sloppily 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
klazukacommented, Mar 5, 2019

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.

0reactions
klazukacommented, Mar 19, 2019

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found