Tip

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

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 etittel@techtarget.com with comments, questions, or suggested topics or tools to review.

This was first published in December 2008

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.