Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VScode ERB and HTML formatter not working together

First question here out of desperation, After a VScode update on [WSL: Ubuntu] I can't seem to get a ERB formatter/Beautify to work together with HTML Snippets (HTML autofill).

It seems that I have to choose one or the other on my seetings.json

With the following ERB works but not my HTML autofill:

{
  "workbench.colorTheme": "Default Dark+",
  "workbench.statusBar.visible": false,
  "editor.minimap.enabled": false,
  "ruby.rubocop.onSave": true,
  "editor.formatOnSaveTimeout": 5000,
  "editor.formatOnSave": true,
  "files.associations": {
    "*.html.erb": "erb"
  },
  "[jsonc]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  }
}

If I change to the following I get the opposite, HTML autofill works but not ERB:

    "*.html.erb": "HTML"
  }

I followed the following solution but it didn't work How do I auto format Ruby or .erb files in VS Code?

I also have Prettier installed and disabling did not change the problem. What am I doing wrong?

like image 710
Daniel Mendez Avatar asked Dec 19 '25 21:12

Daniel Mendez


1 Answers

Found a solution adding this to settings.json

"emmet.includeLanguages": {
    "erb": "html",
    "ruby": "html"
  },
like image 133
Daniel Mendez Avatar answered Dec 22 '25 12:12

Daniel Mendez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!