Skip to content

Autoindent inconsistencies #128

@GHGibonus

Description

@GHGibonus

While editing a fork of elm-vim, I noticed some unexpected behaviors in the way autoindent works. Notably I found two issues.

  1. else clauses in if expressions do not align with the parent if:
    When I write an if else expression, I expect autoindent to align the else with a parent if, like so:

    fun : Int -> Bool
    fun x =
        if x == 0 then
            False
        else
            True

    Instead, when I type else, else do not align itself with the parent if. I get the following:

    fun : Int -> Bool
    fun x =
        if x == 0 then
            False
            else
                True

    Note that the former is the way let in expressions work and it is reasonable to assume that if else expressions would work the same way.
    This is a non-issue when using a snippet insertion plugin such as UltiSnip. However, having the base indent plugin work is a nice goal to have.

  2. Operators starting a new line do not in indent.
    When using the pipe operator especially, one expects that the line is indented such as:

    fun : List a -> List a
    fun l =
        tail l
            |> reverse
            |> drop 5

    However, what I get is the following:

    fun : List a -> List a
    fun l =
        tail l
        |> reverse
        |> drop 5

Looking at the indent/elm.vim file, I found that those behaviors were intended, but the implementation just do not work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions