Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCODE - How to auto closing html code of ruby on rails html.erb file

I want to auto closing the html code in the html.erb file.
What should I do?


Added screenshots


enter image description here
like image 920
COLEAN Avatar asked Mar 31 '18 14:03

COLEAN


3 Answers

  1. Install the Ruby extension.
  2. Add this to your user settings:

    "emmet.includeLanguages": {"erb": "html"}
    

Example with erb and ruby:

VSCode User Settings

like image 101
bryanlo22 Avatar answered Oct 12 '22 08:10

bryanlo22


You don't need to install any extension, just add this to you User settings.json file in VSCode at the end of the file, and it will work like a charm.

"emmet.showSuggestionsAsSnippets": true,
"emmet.includeLanguages": {"html.erb": "html", "erb": "html"}

More info about emmet suggestion ordering

like image 18
meenachinmay Avatar answered Oct 12 '22 09:10

meenachinmay


Install Auto Close Tag Extension

html.erb file is included by default

like image 6
Toh Avatar answered Oct 12 '22 10:10

Toh