Accepted answer

visual studio code detect .jsx extensions and add emmet support by default ( i'm using vs code 1.8.1)

but if you prefer to use .js extention for all your react files - you can associate javascript react mode with .js files in bottom right corner of vs code window.

how to do this step by step (gif)

enter image description here

update 2021

for those who just want to copy-paste the code:

"emmet.syntaxprofiles": {
  "javascript": "jsx"

if the solution above doesn't work, try this:

"emmet.triggerexpansionontab": true,
"emmet.includelanguages": {
  "javascript": "javascriptreact"

tested with vs code v1.56.2.


just name the file you are working on from .js to .jsx and you are fine .


autocomplete for react babel was working fine until yesterday for me.

none of these answers helped so i just restarted my computer. worked like a charm ;)


i was working on various projects and i have a big settings file.

i checked settings and found out that this settings was ruining that all.

"emmet.showexpandedabbreviation": "inmarkupandstylesheetfilesonly"

so i commented it. and everyhting works perfectly in react apps. thanks


only work in jsx files. let it not work with js.

"files.associations": {
"*.js": "javascript",
"*.jsx": "javascriptreact",
"emmet.triggerexpansionontab": true,
"emmet.includelanguages": {
    "javascriptreact": "javascriptreact"


it took me two steps to get auto-closing tags in jsx.

  1. follow kehkashan fazal's instructions above about setting "emmet.includelanguages"
  2. download the auto close tag extension from vscode (

and now you have nice auto-closing jsx tags!


follow these two steps only:

  1. on bottom of vscode where detect language click on that

1st step

  1. click on "configure 'javascript(babel)' language based settings..." or what ever

2st step

  1. paste this code on it separate first by comma ',' and save it.

"emmet.includelanguages": { "javascript": "javascriptreact" }, "emmet.triggerexpansionontab": true

3rd step


adding an item called javascript with value javascriptreact in the emmet section in settings worked for me.

a screen shot of my settings


changing the extension from ".js" to ".jsx" will do the job. but in a case that you want to keep ".js" extension follow below steps.

go to

files > preferences > settings

in the settings tab you will see two tabs named 'user' and 'workspace' (look close to the bottom of search bar). both the tabs will show you same settings but user settings will effect for all the projects in vs code while workspace will effect only for current project. choose whatever option you want, workspace or user.

and then on the left side menu bar you have to go

extensions > json

then at the right side you can see several settings. scroll down a little bit and you will see something like this.

associate schemas to json files in the current project.
edit in settings.json

click on "edit in settigns.json". it will open a json file. add below code to the json file.

"emmet.triggerexpansionontab": true,
"emmet.includelanguages": {
    "javascript": "javascriptreact"

and save the file. now go and check if your js file supports for jsx auto-completion. this has been tested with

vs code versino 1.61.2.

p.s. -: following part is only for the learners who don't know about json.

copy and paste the above code to the bottom of settings.json file as shown in the following image. don't forget to add a comma (pointed by red arrow) and the code should be pasted before the last closing curly bracket (pointed by yellow arrow).

if you choose workspace settings tab then there might be nothing in you settings.json file. if so just paste the code inside the curly brackets. enter image description here


you can use the auto close extention in visual studio code . ps. when you install the extension, the autocomplete won't work until you reload vs code , just reopen vs code , or go to auto close tag extension and click reload.

link of the auto close tag extension


i went throw all answers and this config worked for me. had to include language as well as add syntaxprofile. without the trigger expansion nothing worked but now i only press tab button to get the result.

"emmet.includelanguages": {
    "javascript": "javascriptreact"
"emmet.syntaxprofiles": {
    "javascript": "jsx"
"emmet.triggerexpansionontab": true


  1. just go to settings in vscode.
  2. you can see a search bar in setting type emmet.
  3. scroll down, there is an option include language.
  4. click on the add item button in include language.
  5. add item as javascript and value as javascriptreact.

if you get confused, please refer to the picture below: enter image description here


i solved the problem simply by following the steps below:

  1. on the left bottom of vscode click to javascript
  2. then on the top, you will see a list, click on "configure 'javascript' language based settings"
  3. add these lines to the file:

    "emmet.triggerexpansionontab": true,
     "emmet.includelanguages": {
       "javascript": "javascriptreact"

if you want to more details, you can check this link.


easy & modern way to enable the auto suggestions for jsx for reactjs is shown in gif below.

for windows => file > preferences > settings

for macos => code > preferences > settings

then follow the steps shown in gif.

enter image description here


2019 update

auto closing tags in .html, .js, and .jsx

works out of the box. that is, after typing in the closing bracket to the opening tag, the closing tag will be inserted automatically.

emmet with basic html in .jsx files

works out of the box.

emmet with basic html in .js files:

add the following setting, required for emmet abbreviation suggestions, and required for tab expansion to work consistently.

  "emmet.includelanguages": {
    "javascript": "javascriptreact"

emmet with custom tags (e.g. react components) in both .js and .jsx files

add the following setting:

  "emmet.triggerexpansionontab": true,

note that with this setting, emmet will expand all words as custom tags (not just react component names)

also note that when using emmet to expand react components as custom tags, you have to actually choose the component name from the suggestion list and complete that first (or type out the whole name manually and close the suggestion menu with the escape key). after the word expands, you then have to tab again to get emmet to expand the custom tag.

there's an active feature request to potentially remove this extra step (automatically expand when selecting the suggestion so that it works the same way as expanding standard html tags would).


ensure you have the latest version of vscode.

ensure you did not change the following default settings:

"html.autoclosingtags": true,
"javascript.autoclosingtags": true,
"typescript.autoclosingtags": true,

// read the github issue listed above if you're curious why this is required).
"editor.wordbasedsuggestions": true,

// you obviously don't want javascript, javascriptreact included in here if you want emmet to be available in those files
"emmet.excludelanguages": [


none of those solutions worked... but the auto close tag extension does!


simple answer in 2020

first, select the file association in the bottom-center-right of the window. enter image description here

second, select configure file association for .js from the menu that drops down at the top-center of the window. change it to javascript react. enter image description here



i'm using vscode (ver 1.27.2)

base on my experienced, even though i'm working with react . the detected language on my vscode is still vanilla javascript. and emmet did not work.

  • one of the ways to make it work again is change the vscode detected language to javascript react. this is for single js file only.

vscode options

  • to change it once entirely, you need to associate it.


click configure file association for .js...


and select jsx , which in my case, i already did.


  • for workplace setting, and last if none of them work for you. go to preference of just to ctrl + , (comma) to open it.

type and search for emmet or emmet. then copy the setting you want to override. in my case:

    "emmet.triggerexpansionontab": true,
    "emmet.includelanguages": {
        "javascript": "javascriptreact"

note: i didn't try to use jsx only javascriptreact.


i implemented the second and third step. and i can now do emmet.


just select the appropriate language mode at the bottom-right on the screen: set it to javascript react.


if someone is still struggling with this issue:

i have discovered that simply setting

"emmet.syntaxprofiles": {
     "javascript": "jsx" 

does not enable html completion. but, using:

"emmet.includelanguages": {
    "javascript": "html"


according to emmet docs:

"emmet.includelanguages": {}

enable emmet abbreviations in languages that are not supported by default. add a mapping here between the language and emmet supported language.
eg: {"vue-html": "html", "javascript": "javascriptreact"}


2019: straight-to-the-point answer for react

the most straight-forward way to get jsx/html autocomplete in your react projects is to add this to your user settings or workspace settings (<project-path>/.vscode/settings.json):

      "emmet.includelanguages": {
        "javascript": "javascriptreact"
      "emmet.triggerexpansionontab": true

you may have to restart vs code for the change to take effect.

p.s. if you're not doing this mapping for a react.js project, then kehkashanfazal's answer should probably work for you.

Related Query

More Query from same tag