I'm sure I'm missing something simple, but I simply can't get React.js IntelliSense to work in Visual Studio code.
I have done the following:
npm install typings
ext install Typings Installer
in Visual Studio Codeext install Typings
in Visual Studio Codetypings init
in the root directory of my "app"typings install --ambient react-global
in the root of my "app"That's created a typings
folder. My app is structured in the following folder structure:
├───public
│ ├───css
│ └───scripts
| └───test.js
└───typings
├───browser
│ └───ambient
│ └───react-global
└───main
└───ambient
└───react-global
Yet when I'm in test.js
and type React.
I get no IntelliSense.
I presume I'm missing something fundamental?
You can trigger IntelliSense in any editor window by typing Ctrl+Space or by typing a trigger character (such as the dot character (.)
If IntelliSense is not working as it should on your Windows 11/10 PC, you can try restarting VS Code and this should solve the issue. Restarting the program can be really effective and time saving in some cases. If the issue persists, you can try restarting your computer altogether.
The suggestion list of Basic completion appears when you press the default Visual Studio IntelliSense shortcut Ctrl+Space . If necessary, you can always return to the Visual Studio's native's IntelliSense. To do so, select Visual Studio on the Environment | IntelliSense | General page of ReSharper options ( Alt+R, O ).
You need to add jsconfig.json to the root of your workspace
https://code.visualstudio.com/docs/languages/javascript#_javascript-projects-jsconfigjson
[Note: you can even leave the jsconfig.json
file empty]
Now that typings (and for that matter tsd) are both no longer recommended. I found the one line answer for my situation was just to include type definitions from npm with the command
npm i @types/react --save-dev
intellisense picked up the new definitions for me immediately in Visual Studio Code, but perhaps for someone else you may need to restart your VSCode window.
I'm not sure if it's relevant but my app was created with create-react-app with the latest version.
If anyone else encounters this question in March or April 2016, you might also wish to check this issue in github to see if it has been closed:
https://github.com/Microsoft/vscode-react-native/issues/61
Essentially, using import React, { Component } from 'react'
ES6-style module import causes Salsa's Intellisense not to work, the workaround is to use require:var React = require('react'); var { Component } = React;
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