I'm using Visual Studio Code. How can I enable emmet on .tsx files?
I'd like a simple
.foo + tab
to be expanded to
<div className="Foo"></div>
However, nothing I tried seemed to trigger emmet with the desired behavior above.
Here's my VSC settings:
"emmet.triggerExpansionOnTab": true,
"emmet.includeLanguages": {
"javascript": "javascriptreact",
"typescript": "typescriptreact",
},
To enable the Emmet abbreviation expansion in file types where it is not available by default, use the emmet. includeLanguages setting. Make sure to use language identifiers for both sides of the mapping, with the right side being the language identifier of an Emmet supported language (see the list above).
CodePen supports Emmet. In HTML, try typing header. main-header>nav>ul. site-nav>li*6>a then pressing TAB.
Emmets don't work in JS files. However, you can set it so that VS Code thinks that it's a JSX file and it would give React IntelliSense.
I set this in my VS Code user settings and it works as desired for .tsx
files:
"emmet.includeLanguages": {
"javascript": "javascriptreact",
"typescript": "typescriptreact"
}
"emmet.includeLanguages": {
"javascript": "javascriptreact",
"typescript": "javascriptreact"
},
this is my setting, it can work well
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With