Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode not autocompleting HTML tags in React

Before updating VSCode to the latest version (1.14, I had 1.13) when I was working on my React projects, I could type, for example, div + TAB key and it autocompleted . Also, If I typed div.row it autocompleted it to , but now it doesn't work anymore. When I type div and press the TAB key, it only indents the line. I have the HTML Snippets extension installed.

Does anyone how can I get the autocompletion to work like before?

like image 533
Julio Avatar asked Jul 15 '17 01:07

Julio


1 Answers

Visual Studio Code 1.14 introduced a new settings called emmet.useNewEmmet which defaults to true.

When set to true it'll per default disable the setting emmet.triggerExpansionOnTab.

Changing emmet.useNewEmmet to false will re-enable the tab expansion.

However since the useNewEmmet settings is the way going forward, my recommendation is to keep useNewEmmet set as true but instead add two extra settings;

"emmet.includeLanguages": {
    "javascript": "javascriptreact"
    // any other languages you'd like
},
"emmet.showExpandedAbbreviation": "always"

Restarting VS Code after adding these two will make the editor suggest Emmet abbreviations again and you'll have the same behavior as pre 1.14 release.

like image 73
Henrik Andersson Avatar answered Sep 30 '22 16:09

Henrik Andersson