jcollard / elm-mode

Elm mode for emacs
GNU General Public License v3.0
375 stars 67 forks source link

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

Open indigo0086 opened 7 years ago

indigo0086 commented 7 years ago

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

mnannola commented 7 years ago

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")
kyepskee commented 4 years ago

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

purcell commented 4 years ago

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