elm-mode icon indicating copy to clipboard operation
elm-mode copied to clipboard

Indentation Cycling with else-if nested inside another if form not working correctly

Open indigo0086 opened this issue 8 years ago • 3 comments

When attempting to do a nested else-if then form inside an if form the indentation adds extraneous spacing and you are unable to cycle proper indentation. I use elm-format to correct it of course but the cycling seems to not be elm specific. Asking around on twitter I was informed that it is using a haskell format instead of elm specific for tab cycling. Here is a small recording peek 2016-12-17 13-38

indigo0086 avatar Dec 17 '16 21:12 indigo0086

I just ran into this as well, and not even on a nested if.

Here is the statement I have that causes an incorrect indentation on the second else if line

viewValidation model =
    let
        (color, message) =
            if model.password /= model.passwordAgain then
                ("red", "Passwords do not match!")
            else if String.length model.password < 9 then
                ("red", "Password needs to be longer than eight characters")
                    else if
            else
                ("green", "OK")

mnannola avatar Mar 18 '17 22:03 mnannola

I have the same issue, hope it gets resolved. I'd just like to point out that the issue arises with a single else if, I think it's just not accounted for in indent. It doesn't need to be nested

kyepskee avatar Apr 23 '20 09:04 kyepskee

Yeah, it's all a bit inscrutable to me, tbh, since it began as a mangled haskell indentation system.

purcell avatar Apr 24 '20 00:04 purcell