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
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.
I have been prototyping to add arbitrary LSP requests to Zed itself, and it does seem to work. I wonder if it's worth a PR to zed-industries/zed 🤔
Yeah, I have been playint with a similar concept. I think the idea makes sense in general, but on the LSP level: special requests/responses for delegating comment handling to language servers, e.g. experimental/toggleComment (or something similar). Right now, herb uses the herb prefix, so adding a special LSP command just for it would probably be rejected by the Zed team, but asking to land something more general, I think, has more chances.
Yeah that makes sense! My prototype just has a general send_language_server_request on the Zed/Editor level, that the Zed Ruby Extension then can use to send the specific toggleComment request to the language server.
Activity
marcoroth commentedon Mar 10, 2026
I think this is mostly blocked by this issue in Zed: zed-industries/zed#20042
I have been prototyping to add arbitrary LSP requests to Zed itself, and it does seem to work. I wonder if it's worth a PR to
zed-industries/zed🤔vitallium commentedon Mar 10, 2026
Yeah, I have been playint with a similar concept. I think the idea makes sense in general, but on the LSP level: special requests/responses for delegating comment handling to language servers, e.g.
experimental/toggleComment(or something similar). Right now,herbuses theherbprefix, so adding a special LSP command just for it would probably be rejected by the Zed team, but asking to land something more general, I think, has more chances.marcoroth commentedon Mar 10, 2026
Yeah that makes sense! My prototype just has a general
send_language_server_requeston the Zed/Editor level, that the Zed Ruby Extension then can use to send the specifictoggleCommentrequest to the language server.