You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
indentation doesn't work well with HEREDOC strings in erb #361
bracket matching doesn't also work; when on the > in %>, tha highlighted bracket is on second < in <<~EOF while it should be on < in <%=. Is this plugin also responsible for it?
The indenting thing is a tricky issue. In general, there are two styles that eruby is mostly able to handle:
<div>
<%= foo = {
bar: 'baz'
} %>
</div>
<div>
<%=
foo = {
bar: 'baz'
}
%>
</div>
The mixture of the two doesn't work for a lot of other things:
<div>
<%= foo = {
bar: 'baz'
}
%>
</div>
In the heredoc case, unfortunately, the first format is syntactically invalid, because heredocs expect the end delimiter to be on its own line. Honestly, I wouldn't use a heredoc in ERB for that reason alone, it seems pretty fiddly regarding whitespace. You could use the %{ } delimiter, and that seems to work well with the closing ERB delimiter:
<div>
<%= foo = %{
String content
} %>
</div>
You could also use the second kind of indenting, like this:
<div>
<%=
foo <<~EOF
Bla
EOF
%>
</div>
I understand that, ideally, putting a closing delimiter at the right indent level should work regardless. It's a difficult problem to fix, though, and I really don't think anybody right now would have the time and energy to put into fixing it. I'll leave this issue open, because it's valid, but I'd recommend you try out a different indentation style.
As for the highlighting, it seems to me like it's built-in and not really customizable.
Activity
graywolf commentedon Nov 9, 2017
>in%>, tha highlighted bracket is on second<in<<~EOFwhile it should be on<in<%=. Is this plugin also responsible for it?AndrewRadev commentedon Nov 19, 2017
The indenting thing is a tricky issue. In general, there are two styles that eruby is mostly able to handle:
The mixture of the two doesn't work for a lot of other things:
In the heredoc case, unfortunately, the first format is syntactically invalid, because heredocs expect the end delimiter to be on its own line. Honestly, I wouldn't use a heredoc in ERB for that reason alone, it seems pretty fiddly regarding whitespace. You could use the
%{ }delimiter, and that seems to work well with the closing ERB delimiter:You could also use the second kind of indenting, like this:
I understand that, ideally, putting a closing delimiter at the right indent level should work regardless. It's a difficult problem to fix, though, and I really don't think anybody right now would have the time and energy to put into fixing it. I'll leave this issue open, because it's valid, but I'd recommend you try out a different indentation style.
As for the highlighting, it seems to me like it's built-in and not really customizable.
graywolf commentedon Jan 31, 2018
I'll just switch to
thanks :)