Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
284 views
in Technique[技术] by (71.8m points)

javascript - VS Code not suggesting JSX attributes

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...