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

6.3k Views Asked by At

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.

The problem is all of the methods to enable Intellisense for the project are not suitable.

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?

So to clarify, I'm looking for a method of enabling jQuery IntelliSense without modifying my VS2010 project, hopefully through VS2010 options or something.

2

There are 2 best solutions below

3
On

If you put jquery-vsdoc.js besides your jquery.js, just the reference to jquery.js is enough to have IntelliSense running. And it is probably valid not only for jquery but for other files with -vsdoc.js (maybe .debug.js too). VS2008 SP1 Hotfix to Support "-vsdoc.js" IntelliSense Doc Files. The article is about VS2008 and I write about VS2010 but I suppose statements are valid (I have tried only jquery-vsdoc.js). This technique works in .aspx but not in .html.

You can also use a master page see JScript IntelliSense FAQ.

4
On

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.

enter image description here

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

install-package jquery in the package manager console.

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