Reputation: 31
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.
Upvotes: 3
Views: 2569
Reputation: 11
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.
Upvotes: 1
Reputation: 2306
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.
Upvotes: 2
Reputation: 180641
You may be seeing this issue: there was a recent regression in emmet functionality, see Emmet does not work in js/jsx files for VS Code 1.62.2(Universal) .
It appears to be fixed in the Insiders Build and should be out in Stable in early December 2021.
Upvotes: 1
Reputation: 21
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.
Upvotes: 2