Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting produces invalid code when comment is in pattern of a case expression #824

Open
jfmengels opened this issue Jul 15, 2024 · 1 comment

Comments

@jfmengels
Copy link

When introducing a comment in a pattern in a case expression, elm-format will reformat it like the following:

value =
    case x of
        A
            -- comment
            ()
        ->
            1

        B
        -- comment
        ->
            1

Here, both branches are considered to be a syntax error. The -> needs to be indented by at least one space (or move to after the () in the first pattern).
(more complete example: https://ellie-app.com/rHrcvrMP88Ha1)

@avh4
Copy link
Owner

avh4 commented Jul 21, 2024

Ah thanks! I think that's been in there for at least 2 years before anyone noticed it 😆 This is something #36 would have caught, but it's sadly been too much of a mess to get implemented easily.

I can probably get to this over the summer. Also PR is welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants