最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Using emmet with a react app in vs code is not working - Stack Overflow

programmeradmin1浏览0评论

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.

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.

Share Improve this question edited Dec 2, 2021 at 19:54 Mark 185k30 gold badges543 silver badges552 bronze badges asked Nov 15, 2021 at 8:54 needhelponmathneedhelponmath 311 silver badge2 bronze badges 3
  • Do you have the emmet extension? – kevin Commented Nov 15, 2021 at 9:00
  • Emmet was working until yesterday but it suddenly stop working this – needhelponmath Commented Nov 15, 2021 at 9:17
  • Support for Emmet snippets and expansion is built right into Visual Studio Code, no extension required. This is what visual studio docs say – needhelponmath Commented Nov 15, 2021 at 9:38
Add a ment  | 

4 Answers 4

Reset to default 2

Saw this from a previous thread and it worked for me, but use emmet autoplete 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 mon "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.

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.

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.

发布评论

评论列表(0)

  1. 暂无评论