Using emmet with a react app in vs code is not working

Viewed 1137

In VS Code React emmet is not working even though I have this setting in my settings.json file

"emmet.includeLanguages": {
    "javascript": "javascriptreact"
}

Does anyone have the same problem? Any solution would be perfect.

4 Answers

Saw this from a previous thread and it worked for me, but use emmet autocomplete on a normal HTML file (index.HTML) and it should work for your JSX too.

As linked to the github issue by Mark, this is relatively new and not related to other common "Emmet not working" posts. Apparently it's rooted in an unexpected delay with Emmet recognizing filetypes in a workspace. Manually expanding in an HTML file seems to kicks it back into gear.

For me though, even that wasn't working. I had no issues a week ago but now Emmet was unresponsive regardless of filetype.

I followed a suggestion in the same github thread to also add

 "emmet.triggerExpansionOnTab": true,

And that seemed to work. Remember to close all open VS code windows. I had a second window open which I think was also preventing the new setting from applying.

I had the same problem indeed.

Emmet>including Language>"javascript":"javascriptreact"

was present but I cannot use it in react JSX although it was working in plain HTML. Then I installed an extension called JSX HTML Which solved my problem.

Related