Vik*_*sal 5 visual-studio-code
我是VS Code的新手,想用它来开发AngularJs应用程序.但是,我遇到了在所有JS文件的顶部添加引用链接的问题.
像这样.
/// <reference path="path/to/typings/tsd.d.ts" />
Run Code Online (Sandbox Code Playgroud)
有替代品吗?
默认情况下,在Visual Studio Code中打开的所有JavaScript文件都被视为独立单元.如果要为整个项目启用IntelliSense,请记住将jsconfig.json
文件放在项目的根目录下.
下面是一个jsconfig.json
文件,它将JavaScript目标定义为ES6并排除node_modules文件夹.
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"allowSyntheticDefaultImports": true
},
"exclude": [
"node_modules"
]
}
Run Code Online (Sandbox Code Playgroud)
您可以通过使用DefinitelyTyped存储库中的类型定义.d.ts
文件来获取AngularJS库的IntelliSense .使用Typings manager 可以轻松管理打字.
要安装Typings manager执行npm install typings --global
.这将安装typing manager作为您的全局npm模块.然后,您可以使用命令安装AngularJS Definitionstypings install dt~angular --global
.这将从DefinitelyTyped存储库中安装和持久化定义作为全局定义.
您可以使用列出可用定义typings search angular
.
现在,您可以为项目中的所有文件提供IntelliSense,而无需添加///
引用.
您可以在VS Code手册中找到更多信息.
希望这可以帮助!
归档时间: |
|
查看次数: |
7196 次 |
最近记录: |