php intellisence,VSCode IntelliSense

工具 :VSCode 1.0.0

插件 : react native tool 0.1.4

node 插件:npm install typescript@next -g

按照官方教程,vscode 打开js文件,右下角状态栏并没有显示salsa(不太确认Intellisense功能是否开启,但是只能部分代码提示)

If you have tested the Salsa preview in the past and have configured the typescript.tsdk setting, then please make sure to remove it. Otherwise you might be using an older version of TypeScript. When you have typescript.tsdk set, then the TypeScript version is shown in the bottom right of the Status Bar.

这是他给的建议是 : 之前有使用早期版本,并通过typescript.tsdk来指定typescript,应该去除这些指定。原因是可能会使用到旧版本的typescript。

初次接触vscode 这之中提到的salsa也并不是了解,只是希望功能上满足(代码提示、语法检查)。按照官方的方式没有显示出salsa,那就强制使用typescript(其实语法检测这一块一直是强制使用,但是在右下角的状态栏上显示不出来)。

vscode显示typescript版本

安装 typescript

npm install typescript@next -g

配置settings.json(位置在项目中的.vscode,通过typescript.tsdk指定typescript的lib路径)

{"typescript.tsdk":"/Users/xxxx/.nvm/versions/node/v5.9.1/lib/node_modules/typescript/lib"}

重新启动vscode,随意打开一个js文件,会显示typescript版本号:

a8ffb90b535f

屏幕快照 2016-05-05 上午12.30.58.png

vscode识别使用了ES6风格的react native(即通过import方式引入 :import React from 'react-native')

官方给的原因如下 :

The issue is that the react-native typings do not define a default export. By adding the new compiler option allowSyntheticDefaultImports to the jsconfig.json, you tell the compiler to create synthetic default members and you get IntelliSense.

通过新建jsconfig.json并添加如下内容:

{

"compilerOptions": {

"target": "ES6",

"allowSyntheticDefaultImports": true

}

}

我在本机环境中添加以上内容并没有效果,反而在tsconfig.json中添加就解决了:

{

"compilerOptions": {

"allowJs": true,

"target": "ES6",

"allowSyntheticDefaultImports": true

},

"exclude": [

"node_modules"

]

}

运行效果:

a8ffb90b535f

Paste_Image.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值