简体   繁体   English

在VS2010中启用jQuery Intellisense而不引用本地jQuery(或在每个文件中)

[英]Enable jQuery Intellisense without referencing local jQuery (or in each file) in VS2010

So I've been looking at jQuery and thought it would be nice to have the vsdoc's for the project I'm working on. 所以我一直在关注jQuery,并认为将vsdoc用于我正在进行的项目会很好。

The problem is all of the methods to enable Intellisense for the project are not suitable. 问题是为项目启用Intellisense的所有方法都不合适。

I need to be able to enable IntelliSense without referencing the vsdoc in each file and we also currently use the jQuery CDN so need an option without modifying any of the code itself, is there any options or anything that allow me to add external jsdoc's? 我需要能够在不引用每个文件中的vsdoc的情况下启用IntelliSense,并且我们当前还使用jQuery CDN,因此需要一个选项而无需修改任何代码本身,是否有任何选项或任何允许我添加外部jsdoc的选项?

So to clarify, I'm looking for a method of enabling jQuery IntelliSense without modifying my VS2010 project, hopefully through VS2010 options or something. 所以要澄清一点,我正在寻找一种方法来启用jQuery IntelliSense而无需修改我的VS2010项目,希望通过VS2010选项或其他东西。

If you put jquery-vsdoc.js besides your jquery.js , just the reference to jquery.js is enough to have IntelliSense running. 如果你把jquery-vsdoc.js放在你的jquery.js之外,那么对jquery.js的引用就足以让IntelliSense运行了。 And it is probably valid not only for jquery but for other files with -vsdoc.js (maybe .debug.js too). 它不仅对jquery有效,对于其他带-vsdoc.js的文件(也可能是.debug.js)也可能有效。 VS2008 SP1 Hotfix to Support "-vsdoc.js" IntelliSense Doc Files . VS2008 SP1修补程序支持“-vsdoc.js”IntelliSense Doc文件 The article is about VS2008 and I write about VS2010 but I suppose statements are valid (I have tried only jquery-vsdoc.js ). 这篇文章是关于VS2008的,我写的是VS2010,但我认为语句是有效的(我只尝试过jquery-vsdoc.js )。 This technique works in .aspx but not in .html. 此技术适用于.aspx但不适用于.html。

You can also use a master page see JScript IntelliSense FAQ . 您还可以使用母版页查看JScript IntelliSense常见问题解答

Go to Tools-Options-Text Editor-Javascript-Intellisense-References and place a reference to the intellisense files for the version of jquery you are using in the Implicit Web group. 转到Tools-Options-Text Editor-Javascript-Intellisense-References,并为您在Implicit Web组中使用的jquery版本的intellisense文件添加引用。

在此输入图像描述

To get the latest jquery files with intellisense use the nuget package installer which by default will create a scripts folder and place the jquery version.js, the min.js and intellisense.js files into... from there you can copy them to the location most of the Microsoft references are placed which is typically 要使用intellisense获取最新的jquery文件,请使用nuget软件包安装程序,默认情况下将创建一个脚本文件夹,并将jquery version.js,min.js和intellisense.js文件放入...中,您可以将它们复制到位置通常是放置大多数Microsoft引用

install-package jquery in the package manager console. 包管理器控制台中的install-package jquery。

C:\Program Files (x86)\Microsoft Visual Studio 11.0\JavaScript\References

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

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