简体   繁体   English

Javascript和VS2012 Intellisense

[英]Javascript and VS2012 Intellisense

I am new to Visual Studio 2012 and Javscript coding. 我是Visual Studio 2012和Javscript编码的新手。 I have two questions i could not find answers on the web: 我有两个问题,我在网上找不到答案:

  1. i have a webforms project and added some js-files to the sript-folder (http://raphaeljs.com/). 我有一个Webforms项目,并向sript文件夹(http://raphaeljs.com/)添加了一些js文件。 Now i want to have Intellisense support for that js-library i added. 现在,我想为我添加的js库提供Intellisense支持。 Is that possible? 那可能吗?

  2. for what is the "_references.js" file in the scripts folder? 脚本文件夹中的“ _references.js”文件是什么? I added all the js-library files to that file but it doesn't enable intellisense. 我已将所有js库文件添加到该文件,但它未启用智能感知。

regards 问候

I'm not sure about Visual Studio 2012, but in 2010, if you drag one JavaScript file onto another one it will add a /// <reference name="MyScript.js" /> line at the top of the second file. 我不确定Visual Studio 2012,但是在2010年,如果将一个JavaScript文件拖到另一个JavaScript文件上,则会在第二个文件的顶部添加/// <reference name="MyScript.js" />行。 If the file being referenced is documented you will get quite useful intellisense, though it is still handy even if not for just being able to explore the surface of the API. 如果所引用的文件已记录在案,您将获得相当有用的智能感知,尽管即使不是仅仅为了探索API表面也仍然很方便。

There is some good information in this question: IntelliSense for Ajax and JavaScript libraries in Visual Studio 这个问题中有一些不错的信息: Visual Studio中的IntelliSense for Ajax和JavaScript库

To put it short, Visual Studio is terrible at intelli-sense for javascript. 简而言之,Visual Studio对JavaScript的理解很糟糕。 It is still light years behind other IDEs like IntelliJ & WebStorm. 与像IntelliJ和WebStorm这样的其他IDE相比,现在还差很多年。

A work around to slap it in line would be to use ReSharper which is a plugin but you need to pay for the license :( 解决这个问题的办法是使用ReSharper,它是一个插件,但您需要支付许可证费用:(

Hope that helps. 希望能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM