Unable to comment out erb file in VScode

Asked 1 years ago, Updated 1 years ago, 58 views

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
}

ruby-on-rails ruby html vscode erb

2022-09-30 19:45

1 Answers

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%>


2022-09-30 19:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.