adamzapasnik / prettier-plugin-erb

Prettier ERB plugin
MIT License
102 stars 26 forks source link

Ruby not formatted if it opens a block #136

Open pelletencate opened 1 year ago

pelletencate commented 1 year ago

Environment:

NOTE: If this bug is ancient and has been fixed upstream in something that requires #49 to be resolved, please close this.

Steps to reproduce:

<% my_awesome_command :this, :list, %i[of arguments is], intentionally: :longer, than: 60.characters %>

<% my_awesome_block_command :but, :when, %i[it takes a block], it: :just, doesnt: :want, to: :format do %>
  <h1>And that's probably a bug.</h1>
<% end %>

Observed

<%
  my_awesome_command :this,
                     :list,
                     %i[of arguments is],
                     intentionally: :longer,
                     than: 60.characters
%>

<% my_awesome_block_command :but, :when, %i[it takes a block], it: :just, doesnt: :want, to: :format do %>
  <h1>And that's probably a bug.</h1>
<% end %>

Expected

I suppose something like:

<%
  my_awesome_command :this,
                     :list,
                     %i[of arguments is],
                     intentionally: :longer,
                     than: 60.characters
%>

<%
  my_awesome_block_command :but,
                           :when,
                           %i[it takes a block],
                           it: :just,
                           doesnt: :want,
                           to: :format do
%>
  <h1>And that's probably a bug.</h1>
<% end %>