While editing an erb file using VScode, the comment out shortcut
Press cmd+/ to get //
and cannot comment out.
Is this because the erb file is identified with the html file?
The settings.json file looks like this:
{
"editor.tabSize": 2,
"editor.renderWhitespace": true,
"files.associations": {
"*.erb": "erb"
},
"emmet.includeLanguages": {
"erb": "html"
},
"workbench.iconTheme": "vscode-icons",
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"html.format.endWithNewline"—true,
"solargraph.autoformat": true,
"files.insertFinalNewline": true,
"workbench.editor.closeEmptyGroups": false,
"files.trimFinalNewlines": true,
"workbench.editor.enablePreview": false
}
If you install and enable the "Ruby" extension (publisher name is Peng Lv), it might be the desired behavior.
("Ctrl+Shift+X" opens the Extensions tab, where you can find Ruby.)
If you enable this extension with the settings.json
mentioned above reflected, you can use the
The html.erb file was recognized as an erb file (the language mode displayed in the lower right corner is now "erb").
"When I did ""cmd+/"" in that state, they commented out as follows."
<%#text%>
© 2025 OneMinuteCode. All rights reserved.