How do I auto format Ruby or .erb files in VS Code?

You can set format associations in VSCode, so .erb files would be treated like .html.

Go to File->Preferences->Settings->Click … in top right corner->Open settings.json

Then add this piece of code to your settings.json

"files.associations": {
   "*.html.erb": "html"
}

This is how I solved this problem. It will remove some of the code highlights but will autoformat HTML templates like an HTML document.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)