jcollard / elm-mode

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

Incorrect Indentation for HTML Attributes #171

Open chwering opened 4 years ago

chwering commented 4 years ago

I have run into two cases related to creating HTML elements where I receive incorrect indentation.

  1. Trying to create an HTML element with a multi-line Html.Attributes list as the first parameter results in the 2nd parameter being incorrectly indented.
  2. Creating a list of HTML elements results in the parameters for all elements except the first to be incorrectly indented

In both cases I have indented as much as elm-indent-cycle will allow

test : Html Msg
test =
    p
    [ class "t1"
    , class "t2"
    ]
[ text "test" ]

test2 : List (Html Msg)
test2 =
    [ p
      [ class "t3" ]
      []
    , p
  [ class "t4" ]
  []
    , p
  [ class "t5" ]
  []
    ]

Running elm-format on the same file produces the correct:

test : Html Msg
test =
    p
        [ class "t1"
        , class "t2"
        ]
        [ text "test" ]

test2 : List (Html Msg)
test2 =
    [ p
        [ class "t3" ]
        []
    , p
        [ class "t4" ]
        []
    , p
        [ class "t5" ]
        []
    ]

I am running Emacs 26.3 and elm-mode 20200602.500