Problem solve Get help with specific problems with your technologies, process and projects.

Visual Studio's IntelliSense for jQuery doesn't autocomplete correctly

Microsoft announced at PDC that Visual Studio's IntelliSense now supports jQuery, a powerful Ajax library. But it turns out it doesn't autocomplete all of jQuery's commands correctly. This tip explains what's broken - and what you need to do to use IntelliSense for jQuery.

The home page for jQuery is aptly titled "The Write Less, Do More, JavaScript Library." In slightly more descriptive terms, jQuery is designed to simplify HTML document navigation, event handling, animations and Ajax interactions with an eye toward speeding Web development. It's designed by some serious JavaScript heads for other serious JavaScript heads to help them accomplish minor miracles using incredibly concise and compact code. But until recently, this capability did little for Visual Studio developers, because the IntelliSense facility didn't really know what to make of (or how to deal with) jQuery as a part of its JavaScript auto-coding and auto-completion capabilities.

On November 21, the vice president of Microsoft's .NET Developer division, Scott Guthrie, announced that his group had produced "great jQuery IntelliSense support" in for both Visual Studio 2008 and the free Visual Web Developer 2008 Express package in collaboration with the jQuery development team. This delivers on his promise, made in September, that such support would be forthcoming. Guthrie's blog post has instructions on how to grab and install the proper hotfix to add this capability.

But it turns out that while you can indeed use IntelliSense with jQuery now, there's a little more work involved in using it effectively -- or, as the JavaScript heads might put it, in remaining true to the "write less, do more" mission. JQuery supports lots of concise shortcuts to facilitate its "write less" abilities, but IntelliSense must be guided and even tricked to work as naturally as possible with native, compact jQuery syntax.

Several programmers have written about this problem in detail. Brad Vincent noted the IntelliSense jQuery bug in a blog entry more than half a year before all the recent hoopla, and James Hart came up with a clever solution to the jQuery IntelliSense problem in Visual Studio. Hart's fix is to create a dummy JavaScript file that contains stubs to all of jQuery's calls and link to it within Visual Studio; the editor picks up the dummy APIs and auto-completes based on them, but the end-user's Web browser actually uses the jQuery library. Scott Hanselman has also put together a nice tutorial on working with jQuery inside VS 2008.

It's nice to see Microsoft actively supporting widely-used third-party developer tools inside its own products. It kind of makes me think that they get the notion that the whole community can always out-do, and out-develop, any single vendor -- no matter how big, smart, or all-encompassing it might seek to be.

Ed Tittel is a full-time writer and trainer whose interests include XML and development topics, along with IT Certification and information security topics. E-mail Ed at with comments, questions, or suggested topics or tools to review.

Dig Deeper on ASP.NET and Ajax development

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.