Skip to content

Code within Elixir code tags not formatted #55

@aidalgol

Description

@aidalgol

Elixir code within <% %> or <%= %> is not formatted.

Example

Input

<nav class= "navbar">
  <div class ="navbar-group">
      <div   class="navbar-item">
    <div class="buttons" >
        <%= case  something do %>
           <% nil   -> %>
            <%= some_function( "foo", :bar, "boo", "goo", "blah", "bleh", "are we there yet?", "come ooooon!", "how much further?", "I'm borrrred!!") %>
        <% _ -> %>
              <%= boring(:bleh) %>
          <%end %>
      </div>
 </div  >
   </div>
 </nav>

Output

<nav class="navbar">
  <div class="navbar-group">
    <div class="navbar-item">
      <div class="buttons">
        <%= case  something do %>
          <% nil   -> %>
            <%= some_function( "foo", :bar, "boo", "goo", "blah", "bleh", "are we there yet?", "come ooooon!", "how much further?", "I'm borrrred!!") %>
          <% _ -> %>
            <%= boring(:bleh) %>
        <% end %>
      </div>
    </div>
  </div>
</nav>

The tags are correctly formatted, but none of the Elixir code is touched.

We probably don't want to reimplement mix format, so maybe we could pass the code snippets between prettier and the Elixir formatter?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions