JQuery 1.3 and Visual Studio 2008 IntelliSense

Time for an update on the JQuery IntelliSense story.

Since I last updated the blog on this subject, things have moved on enormously:

  • Microsoft started shipping JQuery 1.2.6 with ASP.NET MVC, and announced their intention to do the same with VS 2010.
  • Alongside that, they handed over their own annotated intellisense file to the JQuery project to support intellisense in VS 2008
  • To make that even easier to use, they released a patch for VS2008 SP1 that allows the intellisense parser to read an alternate –vsdoc.js file instead of a real .js file to get intellisense hints.
  • Then today, John Resig announced the release of JQuery 1.3. Great news!

But then, not-so-great news: reference JQuery 1.3 from a file in VS2008, and intellisense falls over in a heap. Looks like there’s something in the new Sizzle CSS selector library component of JQuery that VS just doesn’t like. That disables all JavaScript intellisense in the referencing file. It’s a real shame; MS went above and beyond releasing a pre-SP1 hotfix that enabled intellisense to be compatible with jQuery 1.2, and I know the VS guys have a completely overhauled intellisense engine coming in the next version of VS. But right now, it looks like something in Sizzle’s capability detection code throws the current VS2008SP1 code for a wobbler.

Luckily, if you’re using a –vsdoc.js file to augment jQuery, intellisense doesn’t fail because it ignores the actual jQuery source file. Unfortunately, there’s no intellisense file for JQuery 1.3.

Until now.

Thanks to the fact that up to date API docs have been published immediately on http://api.jquery.com/, I’ve updated the generator script and posted a new JQuery 1.3 intellisense header file up, so you can drop in a jquery–vsdoc.js beside your jquery.js file and get fully-functional, chainable intellisense, including all the latest function signatures.

Note that my file is slightly different to Microsoft’s 1.2.6 file in its structure, and contains no actual jQuery code; it’s likely mine won’t function as well in co-ordination with jQuery extensions, for example. No warranty express or implied, your mileage may vary, etc.

If you need more information on getting JavaScript intellisense working in visual studio, Jeff King’s FAQ is a must-read.

Print | posted on Wednesday, January 14, 2009 5:31 PM

Comments on this post

# New VisualStudio version of 1.3 already :-)

Requesting Gravatar...
Wow are people fast
Left by Pingback/TrackBack on Jan 14, 2009 8:49 PM

# New VisualStudio version of 1.3 already :-)

Requesting Gravatar...
Wow are people fast
Left by Pingback/TrackBack on Jan 14, 2009 8:52 PM

# Hacker News | JQuery 1.3 Released

Requesting Gravatar...
For anyone who uses Visual Studio, here's an accompanying vsdoc for jquery-1.3
Left by Pingback/TrackBack on Jan 14, 2009 8:54 PM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
Thanks very much for that.

I started on the jQuery part of a project yesterday. I was thinking of starting with 1.2.6 until I saw that intellisense was already done.

The speed of this is impressive
Left by Mike Gale on Jan 14, 2009 11:37 PM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
That's awesome... thanks so much. And you're also already the #1 result for "jquery 1.3 intellisense" on Google... nice work!
Left by Dylan on Jan 15, 2009 1:17 AM

# jQuery 1.3來了!!

Requesting Gravatar...
注意: 由於官方版的jquery-1.3-vsdoc.js還未釋出,因此在Visual Studio 2008中使用jQuery 1.3,Javascript Intellisense會有問題,不過不到24小時就已有強者釋出了解決方案,急用的人可以到Jamse的Blog下載jQuery 1.3 intellisense header file存成jquery-1.3-vsdoc.js頂著用。
Left by Pingback/TrackBack on Jan 15, 2009 9:06 AM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
That was fast! I found a link to this blog on the jQuery Google Group. Thanks for the intellisense file.
Left by Tim Banks on Jan 15, 2009 3:19 PM

# Alvin Ashcraft’s Morning Dew

Requesting Gravatar...
jQuery 1.3 and Visual Studio 2008 IntelliSense (James Hart)
Left by Pingback/TrackBack on Jan 15, 2009 3:37 PM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
Oh, man, you're fast! Thank you very much.
Left by Alek Davis on Jan 15, 2009 10:21 PM

# JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
Thank you for submitting this cool story - Trackback from DotNetShoutout
Left by DotNetShoutout on Jan 15, 2009 11:25 PM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
Has someone actually tried it and made it work? For some reason, I'm getting a warning in the IDE (VS 2008 SP 1):
Error updating JScript IntelliSense: jquery-1.3.js: Object doesn't support this property or method @ 2069:1.
This line contains the following statement:
var root = document.documentElement;
I tried it with both packed and unpacked versions of the jQuery.js file, but got the same error in both cases and no IntelliSense. With just vsdoc file, IntelliSense works fine (obviously, there is no functionality). ANy ideas? IntelliSense would definitely be nice.
Left by Alek Davis on Jan 16, 2009 12:11 AM

#

Requesting Gravatar...
Link Listing - January 15, 2009
Left by Christopher Steen on Jan 16, 2009 5:37 AM

# Link Listing - January 15, 2009

Requesting Gravatar...
ASP.NET Time released content in ASP.NET [Via: Jon Galloway ] Code Camps Roanoke Code Camp 09 - Call...
Left by Christopher Steen on Jan 16, 2009 5:38 AM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
If you're having trouble getting it to work, make sure you've got the hotfix installed that enables -vsdoc intellisense files: code.msdn.microsoft.com/.../ProjectReleases.aspx

This will only install on top of VS 2008 SP1.
Left by James on Jan 16, 2009 2:20 PM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
Alek - For this:

Error updating JScript IntelliSense: jquery-1.3.js: Object doesn't support this property or method @ 2069:1.

Try creating a new .net 3.5 website. I got the same error after trying to get jquery intellisense to work with a .net 2.0 site (same with 1.2.6).
Left by Arthur on Jan 17, 2009 7:14 PM

# Unofficial JQuery 1.3 Visual Studio Intellisense File

Requesting Gravatar...
n lieu of the official Visual Studio 2008 Intellisense file for jQuery, the jQuery intellisense file generator at www.infobasis.com/sandpit/jQuery-Intellisense/ has been updated to support jQuery 1.3.0
Left by Pingback/TrackBack on Jan 18, 2009 12:54 PM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
Note if its not working for you check the name of the files you need them to match like
jquery-1.3-vsdoc.js and jquery-1.3.js. The jquery header file this blog points to is named jQuery-vsdoc.js you need to rename it to work with your jquery-1.3.js file.


Left by Jason S on Jan 19, 2009 1:28 PM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
Could you give an example how and where to use vsdoc.js and jquery.js file, pleaszzzzzzzzz....
Left by James on Jan 19, 2009 8:22 PM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
I am getting the same error

Error updating JScript IntelliSense: jquery-1.3.js: Object doesn't support this property or method @ 2069:1.


i tired every way...
the old 1.26 works really good though
Left by Ganesh on Jan 20, 2009 4:11 AM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
Great Post!
Did you know google are hosting JQuery amongst other JS libraries which you can access using the google AJAX Libraries API:

http://web2asp.net/2009/01/google-hosts-jquery-scriptaculous.html
Left by david r on Jan 22, 2009 8:06 PM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
How do I get this to work.

I renamed both to this:

jquery-1.3-vsdoc.js
jquery-1.3.js

I then did this

<script src="../JavaScripts/jquery-1.3-vsdoc.js" type="text/javascript"></script>

<script src="../JavaScripts/jquery-1.3.js" type="text/javascript"></script>

but I get no intellsene

I have VS version 9.0.30428.1 SP 1 beta 1

do I not have the right version?
Left by chobo2 on Jan 30, 2009 2:12 PM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
Jason S was right. I was getting that error as well, but updated the name of my vsdoc file to matach the jquery file and all worked great.
Also, make sure you add the files in the right order on the page.

script src="../../../Scripts/jquery-1.3.1-vsdoc.js" type="text/javascript" /script
script src="../../../Scripts/jquery-1.3.1.js" type="text/javascript" /script
Left by Heba on Feb 03, 2009 9:47 AM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
You should only need to reference the actual jquery-x.js file in your code - you don't need a script tag pointing to the -vsdoc.js file at all. Visual Studio follows the reference to the real jQuery file, notices a -vsdoc.js file alongside it, and parses that one instead.
Left by James on Feb 05, 2009 3:10 AM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
What is the difference between the new JQuery 1.3 intellisense header file and the one published on http://api.jquery.com/?? Why should i use one or the other?
Left by wally mart on Feb 17, 2009 10:29 AM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
I have installed Visual Studio 2008 Pro version 9.0.30729.1 SP. I have created a couple of web sites to test out. None of them have Javascript Intellisense. My javascript resides in the page source, not external .js file. Here is the example I tried for microsoft virtual earth. Did I miss something when I installed the software? Please help!

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<script type="text/javascript" src="dev.virtualearth.net/.../script>
<script type="text/javascript">
var map = null;
var pinid = 0;

function GetMap()
{
map = new VEMap('myMap');
map.LoadMap();
map.SetZoomLevel(10);

}
</script>
</head>
<body onload="GetMap();">
<form id="form1" runat="server">
<div id='myMap' style="position:relative; width:600px; height:600px;"></div>
</form>
</body>
</html>
Left by Judy on Apr 03, 2009 9:26 AM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
Thanks..! that definatly helped me to getr jquery intellisense working for vs2008. appriciated..sir..!
Left by maulik soni on Apr 09, 2009 7:42 AM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
I'm using ajax:ToolkitScriptManager instead of asp:ScriptManager for script references in my master page - the intellisense only seems to work with asp:ScriptManager.

Is there a way for it to work with the ajax version? I use the ajax version because it has the useful combine scripts functionality.

Thanks, Phil
Left by Phil on Apr 30, 2009 3:10 PM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
Thank you, thank you. JQuery, VS2008 *and* Intellisense!!

Kofi
Left by Kofi Sarfo on Jul 09, 2009 12:49 PM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
You are a god! Tonight was the first time my program has compiled without that stupid intellisense error!

I did make 3 copies of your file, one for each .js file I had (3.1.2, 3.1.2-min, and ui) and woo hoo, it worked beautifully!

Thank you so much!
Left by Cheryl Simpson on Jul 23, 2009 6:02 AM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Left by VB on Aug 11, 2009 11:45 AM

# Great work done

Requesting Gravatar...
I don't appreciate as much as JQuery. I just did a simple show/hide JQuery call, which works great and so easy to use. I'm going to venture out and call more extensive jquery functions. Thank you for the code, now I'm more empowered to use jquery more often in my c# .net programming.
Left by London Escort Agencies on Sep 05, 2009 9:18 AM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
thank you man..
i was working with this workaround
<script type="text/javascript" src="<%=ResolveUrl("~/Resources/JavaScripts/jquery-1.3.2.js")%>"></script>
<%If False Then%>
<script src="Resources/JavaScripts/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>
<% End If%>

this was working for me till now.
Regards
Nitesh Chauhan
Left by Alphabytes on Oct 11, 2009 5:32 AM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
You just made my day! Thank you so much!
Left by John Weis on Oct 22, 2009 9:15 PM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
For those of you getting

Error updating JScript IntelliSense: jquery-1.3.2.js: Object doesn't support this property or method

Make sure the doc file is named
jquery-1.3.2-vsdoc.js
Not
jquery-1.3.2-vsdoc2.js
Left by David Johnson on Oct 22, 2009 11:33 PM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
Anyone know if there is a way to avoid errors and get intellisense when you reference a hosted version of jQuery?

I'm pulling from a CDN and even though the -vsdoc.js file is out there as well, I still get the lovely 'object does not support this property or method' and no intellisense.

Switching back and forth between the hosted and local versions is possible but it's exceedingly error prone.
Left by Jason S. Clary on Nov 05, 2009 12:17 AM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
jquery-1.3.2.min.js
jquery-1.3.2.vsdoc2.js
Visual Studio 2008 SP1
KB958502 hotfix applied and still received the Object doesn't support this property or method @ 18:9345 error.
Fixed by renaming both by renaming both JS files.
jquery-1.3.2.js (remove min)
jquery-1.3.2.vsdoc.js (remove 2)

just wanted to share since it took me forever to find the solution.
Left by finally fixed on Nov 05, 2009 6:53 PM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
thank you 'finally fixed'!
Left by Darryl Dalton on Dec 29, 2009 9:34 PM

# re: JQuery 1.3 and Visual Studio 2008 IntelliSense

Requesting Gravatar...
Same problem.. Got solution.. Thanks
Left by Nivetha on Mar 13, 2010 9:17 AM

Your comment:

 (will show your gravatar)
 
Please add 4 and 3 and type the answer here: