elm / error-message-catalog

A catalog of broken Elm programs / data to improve error messages
BSD 3-Clause "New" or "Revised" License
173 stars 17 forks source link

Color coded compile msgs doesn't work when IDE does not support colored console #269

Closed mordrax closed 5 years ago

mordrax commented 6 years ago

When getting the following type mismatch with Webstorm ( which does not highlight console outputs )

This function cannot handle the argument sent through the (|>) pipe:

59|             model
60|                 |> List.filter (\n -> n.privacyFlag /= Types.Api.Enums.FlagYes && n.priority /= Types.Api.Enums.FlagYes)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The argument is:

    List Note

But (|>) is piping it a function that expects:

    List { fields : String
        , fields : Int
        , fields : Enums.MainRefType
        , fields : String
        , fields : String
        , fields : String
        , fields : String
        , fields : Enums.BitFlag
        , fields : Maybe Date
        , fields : Maybe Date
        , fields : String
        , fields : String
        , privacyFlag : Enums.Flag                  -- this one is yellow in the terminal but not in the editor
        , fields : String
        , fields : String
        , fields : Maybe DateTime
        , fields : Enums.Flag
        , fields : String
        , fields : DateTime
        , fields : String
        , fields : Maybe DateTime
        , fields : Float
    }

0.18 was better in pointing out the fields which the compiler had problems with using text. 0.19 only works if the console being used supports color.

norpan commented 6 years ago

Herr is what I did in vscode: https://github.com/Krzysztof-Cieslak/vscode-elm/pull/251

evancz commented 5 years ago

If the editor author uses --report=json they can get the color information and display it however is necessary. An example of that lives at https://package.elm-lang.org/packages/elm/project-metadata-utils/latest/

Please inform the relevant editor plugin author.