Customizing ERB comments


Hello all,

I’d like to customize how atom handles comments in ERB files.

So if I have line like this:


I’d like it to do this:

<%# <span>foo</span> %>

Instead of this:

<!-- <span>foo</span> -->

And going a step further, if I have some lines like this:


I’d like it to do this:

<%# <span> %>
  <%# foo %>
<%# </span> %>

Instead of this:

<!-- <span>
</span> -->

Basically I want to use ‘<%# ’ prefix and ’ %>’ suffix as single-line comments exclusively. Could anyone help point me in the right direction? TIA


Well, the single-line and multi-line comments don’t work the way you’re requesting. So rather than trying to modify that system globally to add a feature for just one language, I’d suggest taking a look at the code I posted about wrapping selected text:

And modify what I have there to wrap or unwrap each selected line the way you want.