Problem
Comment toggling in .html.erb files is naive. The current config sets:
block_comment = ["<%#", "%>"]
This always wraps selections with ERB comment syntax regardless of context. In practice, .html.erb files mix two distinct comment styles:
- ERB tags →
<%# code %> (insert # after <%)
- HTML content →
<!-- content -->
Toggling a comment on an HTML line like <div class="foo"> produces <%#<div class="foo">%> — invalid ERB. The correct output would be <!-- <div class="foo"> -->.
There is also no line comment support, so ⌘/ does nothing useful. yaml-erb has no comment support whatsoever.
Prior Art
Herb's language server shipped exactly this logic in marcoroth/herb#1308. The CommentService classifies each line as erb-tag, erb-comment, html-comment, or html-content by walking the AST, applies the appropriate comment style per line, and handles mixed selections intelligently.
Discussed as a candidate for the Zed Ruby Extension.
Problem
Comment toggling in
.html.erbfiles is naive. The current config sets:This always wraps selections with ERB comment syntax regardless of context. In practice,
.html.erbfiles mix two distinct comment styles:<%# code %>(insert#after<%)<!-- content -->Toggling a comment on an HTML line like
<div class="foo">produces<%#<div class="foo">%>— invalid ERB. The correct output would be<!-- <div class="foo"> -->.There is also no line comment support, so
⌘/does nothing useful.yaml-erbhas no comment support whatsoever.Prior Art
Herb's language server shipped exactly this logic in marcoroth/herb#1308. The
CommentServiceclassifies each line aserb-tag,erb-comment,html-comment, orhtml-contentby walking the AST, applies the appropriate comment style per line, and handles mixed selections intelligently.Discussed as a candidate for the Zed Ruby Extension.