React suggestions and autocomplete does not work for files with js extension in VSCode

Viewed 3926

I need to enable React related suggestions and autocomplete but in files with .js extension in Visual Studio Code. The only way to make it working for me is to change extension from .js to .jsx. I tried everything described in this post but nothing worked for me.

Here is what I mean by React related suggestions and autocomplete. enter image description here

2 Answers

"*.jsx" extension assosiacted with javascriptreact language mode.

Change the file type from javascript to javascriptreact, you can do it from the bottom panel.

Or run Change language Mode from command palette (ctrl+p).

Also, you can add files.associtiations on your settings.json:

  "files.associations": {
    "*.react.js": "javascriptreact",
    "*.jsx": "javascriptreact",
    "*.js": "javascriptreact",
  }

Language Mode

I am also having same problem but when I keep index.js file open in background everything just works. You can also try

Related