Formatting `{}` in heex should indent/format correctly

12 views
Skip to first unread message

Andrew Stewart

unread,
Jul 6, 2024, 9:38:47 AM (22 hours ago) Jul 6
to elixir-lang-core
in a heex file like this:

```
<div class="grow p-3 md:p-6 mx-auto max-screen-4xl">
  <LiveToast.toast_group
    toast_class_fn={&demo_toast_class_fn/1}
    group_class_fn={&demo_group_class_fn/1}
    flash={@flash}
    kinds={[:info, :error, :warn]}
    connected={assigns[:socket] != nil}
    {
      if assigns[:settings] do
        [
          corner: case assigns[:settings]["corner"] do
            "top_right" -> :top_right
            "top_left" -> :top_left
            "bottom_right" -> :bottom_right
            "bottom_left" -> :bottom_left
          end
        ]
      else
        []
      end
    }
  />

  <%= @inner_content %>
</div>
```

the part inside the `{}` does not format at all. You can put any elixir in there, so I think it'd be nice if it formatted it as elixir, indented one level deeper then the {} if they are on their own line.
Reply all
Reply to author
Forward
0 new messages