0

While developing a ReactJs project, VS Code used to suggest attributes for JSX elements. For instance,

<input type="text"></input>

In this scenario if I wanted to add an placeholder I had to just type in the first few letters and the auto-complete popped up suggesting the events.

However it has stopped working all of a sudden and results in this while I try Ctrl+Space in a JS file.

enter image description here

What I have tried so far:

  1. Uninstalled VS Code and removed the user-specific settings from AppData and removed the .vscode folder from User and then reinstalled.

  2. Added

"emmet.includeLanguages": {
    "javascript": "javascriptreact"
    }

in the settings.json based on this

Aniruddha Bera
  • 399
  • 6
  • 19

3 Answers3

1

change the file extension instead of .js || .ts add an x .jsx || .tsx

helps alot if you add a jsconfig.json and install @types/react https://code.visualstudio.com/docs/languages/jsconfig

Ernesto
  • 3,944
  • 1
  • 14
  • 29
1

I had the same problem and this is what solved the problem for me. Just import react from react:

import React from 'react';

Despite this line nowadays isn't required, this makes Vscode recognize somehow and suggest jsx again.

urtadolg
  • 11
  • 2
1

Make sure to check that the "select language mode" tab on the bottom right of the window shows "Javascript React" and make sure that you've installed and enabled the ES7 React/Redux/GraphQL/React-Native extention.

ouflak
  • 2,458
  • 10
  • 44
  • 49
DooMGuy096
  • 252
  • 1
  • 2
  • 12