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

Non-idempotent 'else (if ..)' formatting #634

Open
justinmimbs opened this issue Aug 20, 2019 · 0 comments
Open

Non-idempotent 'else (if ..)' formatting #634

justinmimbs opened this issue Aug 20, 2019 · 0 comments
Labels
0.9 (temporary label for search filtering) bug

Comments

@justinmimbs
Copy link

On this nested if expression, the first pass of elm-format removes the parens, and the second pass removes the indentation.

f =
    if x then
        y

    else
        (if a then
            b

         else
            c
        )

First pass:

f =
    if x then
        y

    else
        if a then
            b

        else
            c

Second pass:

f =
    if x then
        y

    else if a then
        b

    else
        c

While looking to see if this already was reported, I found #427, which proposes preserving indentation like the first pass above. I like that idea, as I was originally trying to format some logic with the same kind of symmetry described there when I came across this non-idempotent behavior.

Thank you for such a wonderful tool that has given me much comfort and saved me countless hours over the years!

Justin

@avh4 avh4 added bug 0.9 (temporary label for search filtering) labels Jan 10, 2022
@avh4 avh4 added this to the 0.9.0-exp (next experimental) milestone Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.9 (temporary label for search filtering) bug
Projects
None yet
Development

No branches or pull requests

2 participants