Get Intellisense support for JQuery in VS

JQuery intellisense has been around for quite a long time. And the great news is that it is officially supported by Microsoft. Its a lightweight JavaScript framework having huger users.

Installing Intellisense support:

  • Make sure you are running the Service Pack 1 of Visual Studio installed. You can download it from here.
  • Then download the JScript editor support for -vsdoc.js patch (KB958502) at the end of this post or from MSDN.
  • Then go to the official JQuery download page at http://docs.jquery.com/Downloading_jQuery#Download_jQuery.

Select the Visual Studio documentation when downloading.

Then reference the JavaScript file you just downloaded

<script type="text/javascript" src="js/jquery-1.3.2-vsdoc2.js"></script>

Now you must be getting the intellisense support in your visual studio. Pages that inherits from master page will get the intellisense support, But the user controls will not be getting the intellisense support. To do that you can use the following hack.

<% if (false){ %>
  <script type="text/javascript" src="js/jquery-1.3.2-vsdoc2.js"></script>
<% } %>

The expression will always evaluate to false. That means *-vsdoc2.js file will never be added to the webpage. But the visual studio will evaluate it and provide the intellisense support.

The way I use JQuery:

Since the *-vsdoc2.js file is quite huge I prefer to use .min.js version of JQuery. I reference it by using the following way.

<script type="text/javascript" src='<%= ResolveClientUrl("~/js/jquery-1.3.2.min.js") %>'></script>
<% if (false){ %>
  <script type="text/javascript" src="js/jquery-1.3.2-vsdoc2.js"></script>
<% } %>

Notice the ResolveClientUrl. Its helpful when your page inherits from the master page and the page lies in different folder.

Another way is rather just reference .min.js file and add the following line at the top of the file.

/// <reference path="jquery-1.3.2-vsdoc.js" />

This allows the Visual Studio to automatically recognize the file and provide appropriate intellisense support.

VS90SP1-KB958502-x86.exe (JSEditor Patch) (2.13 mb) jquery-1.3.2-all.zip (95.67 kb)