在Visual Studio Code中反应智能 [英] React intellisense in Visual Studio Code

查看:100
本文介绍了在Visual Studio Code中反应智能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确定我缺少一些简单的东西,但是我根本无法让React.js IntelliSense在Visual Studio代码中工作.

I'm sure I'm missing something simple, but I simply can't get React.js IntelliSense to work in Visual Studio code.

我已经执行以下操作:

  • npm install typings
  • Visual Studio代码中的
  • ext install Typings Installer
  • Visual Studio代码中的
  • ext install Typings
  • 我的应用"的根目录中的
  • typings init
  • typings install --ambient react-global在我的应用"的根目录中
  • 重新启动Visual Studio代码
  • npm install typings
  • ext install Typings Installer in Visual Studio Code
  • ext install Typings in Visual Studio Code
  • typings init in the root directory of my "app"
  • typings install --ambient react-global in the root of my "app"
  • restarted Visual Studio Code

已创建一个typings文件夹.我的应用程序具有以下文件夹结构:

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

但是,当我进入test.js并键入React.时,我没有任何IntelliSense.

Yet when I'm in test.js and type React. I get no IntelliSense.

我想我缺少基本的东西了吗?

I presume I'm missing something fundamental?

感谢您的帮助,实际上它再次参与其中.我认为我可以使用它,并在这里 http://mattdufeu.co.uk/setup-intellisense-vscode-react-js/

Thanks for your help, it's actually more involved again. I think I have it working and wrote about my steps here http://mattdufeu.co.uk/setup-intellisense-vscode-react-js/

推荐答案

我认为您需要将jsconfig.json添加到工作区的根中

I think you need to add jsconfig.json to the root of your workspace

https://code.visualstudio.com/docs/languages/javascript#_javascript-projects-jsconfigjson

[注意:您甚至可以将jsconfig.json文件留空]

[Note: you can even leave the jsconfig.json file empty]

我在角度问题上也遇到了同样的问题,这为我解决了这个问题.

I had the same issue with angular this resolved it for me.

希望这会有所帮助!

这篇关于在Visual Studio Code中反应智能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆