在Visual Studio 2015中没有针对AngularJS TypeScript的IntelliSense [英] No IntelliSense in Visual Studio 2015 for AngularJS TypeScript

查看:96
本文介绍了在Visual Studio 2015中没有针对AngularJS TypeScript的IntelliSense的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ASP.NET 5& Visual Studio 2015中TypeScript中的AngularJS.但是,即使在安装AngularJS Core&通过NuGet的AngularJS的DefinitelyTyped TS引用,我仍然没有AngularJS库的IntelliSense.

I'm building an app using ASP.NET 5 & AngularJS in TypeScript in Visual Studio 2015. However, even after installing the AngularJS Core & DefinitelyTyped TS references for AngularJS via NuGet, I still don't get IntelliSense for the AngularJS libraries.

我还使用了ReSharper 9.1 AngularJS扩展,该扩展在HTML文件中提供了IntelliSense,但在TypeScript代码中却没有提供.

I'm also using the ReSharper 9.1 AngularJS extension, which gives me IntelliSense in HTML files but not in my TypeScript code.

我还注意到,即使存在对AngularJS的引用和定义文件,但在我的解决方案中找不到这些文件本身.有人知道如何解决这个问题吗?

I've also noticed that even though the references to AngularJS and the definition files are present, the files themselves are nowhere to be found in my solution. Does anybody know how to fix this?

我找到了解决方案.如果您遇到相同的问题,请阅读我的答案.

I have found the solution. Read my answer if you're having the same problem.

推荐答案

我使用DefinitelyTyped定义管理器找到了解决问题的方法: http://definitelytyped.org/tsd/

I have found a solution to my problem using the DefinitelyTyped Definition Manager: http://definitelytyped.org/tsd/

我已经使用NPM在全球范围内安装了tsd:

I've installed tsd globally using NPM:

npm install -g tsd

然后在解决方案的根文件夹中使用命令提示符,通过输入以下命令,安装了AngularJS类型定义:

then using a command prompt in the root folder of my solution, I've installed the AngularJS type definitions by entering the following command:

tsd install angular

它会自动将类型定义下载到名为"typings/angularjs"的文件夹中,并且IntelliSense会按预期开始工作.

It automatically downloaded the type definitions into a folder named "typings/angularjs" and IntelliSense started working as intended.

我还可以确认使用这种方法,不需要AngularJS Core的NuGet包或DefinitelyTyped定义,并且ReSharper不会阻止IntelliSense.

I can also confirm that using this approach, no NuGet packages of AngularJS Core or the DefinitelyTyped definitions are needed and ReSharper does not block IntelliSense.

更新:

TSD似乎已被弃用,并由 typings项目取代.它也与TSD很好地集成在一起,并为TSD用户提供了特定的选项.尽管TSD仍然可以正常运行,但请记住,将来可能不再维护TSD.

It seems like TSD is about to be deprecated and replaced by the typings project. It integrates well with TSD as well and has specific options for TSD users. While TSD still works fine, keep in mind that in the future TSD might not be maintained anymore.

这篇关于在Visual Studio 2015中没有针对AngularJS TypeScript的IntelliSense的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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