JScript IntelliSense: Working with jQuery

JScript IntelliSense: Working with jQuery

Rate This
  • Comments 51

We have good news for jQuery fans.  The hotfix we released today fixes a bug in IntelliSense where it would fail with jQuery.  Any page with jQuery should just work now.  While experimenting with this new-found functionality today, I found annotating the library with a few XML Doc Comments really made a big difference.  The key is to add a return type of "jQuery" like this:

doc comments

Here's some jQuery chaining with IntelliSense:

completion list

tooltip

There were only a few functions that (due to the way they were declared) were not able to be annotated.  Special thanks to Brennan where I borrowed the comments from.  If anyone will be making a fully annotated version of jQuery, I'd be happy to post a link to it from here.

Jeff King
Program Manager
Visual Studio Web Tools

  • 【原文地址】 Feb 17th Links: ASP.NET, ASP.NET AJAX, Visual Studio, .NET 【原文发表日期】 Sunday, February 17, 2008

  • Colegamenti del 17 Febbraio: ASP.NET, ASP.NET AJAX, Visual Studio, .NET

  • Here is the latest in my link-listing series .  Also check out my ASP.NET Tips, Tricks and Tutorials

  • ALan is talking out of his swanny - find me a better IDE than VS and I use it that simple - Jscript - Javascript Alan you so petty.

  • First of all, sorry for my bad english..

    I don't know, how far goes your experience with jQuery, so I'll try hard to make this self-explained.

    In jQuery there are some functions that can get or set a value of a css propertie, or an html attribute of the object in question.

    Some good examples are the functions width(), height(), css("property"), attr("attribute")..

    If you type $(object).width(), you get the value, and $(object).width( val ), you set, of course.

    But the problem is how intellisense handles this, since a function like this can return a string, or the jQuery object itfself, allowing you too continue setting other attributes for this same object, like:

    $(object).width(val).height(val).css("attribute", "val")

    In case you are GETTING the height of the object, for example, intellisense should stop showing after that.

    But, if you are SETTING, it should continue working.

    A great idea, I guess, is to allow us to define multiple definitions for the same function, like in C# intellisense, choosing one with those cool little arrows.

    Something like:

    definition

     summary /

     param /

     return type="jQuery" /

    /definition

    definition

     summary /

     param /

     return type="string" /

    /definition

    Anyway, thanks for the work so far.

  • Dear Scott:

    How about the edition for chinese?  

    When ?

  • @vFragoso: I completely understand the problem you are describing.  We haven't invented a syntax to address that problem yet.  But we'll see what we can do next release.  C# has it easy because of it's types and clear definition of overloads.  In JS--strictly speaking--anything can affect the return type, from the number of arguements, to the type of the arguments, to the value of the arguments.  To absurdity, you could vary the return type on Math.random().  We would want to account for the variety of possibilities... although probably not that last one. =)

  • Hi,

    Waiting for you prototype.js fix.:)

  • Here is the latest in my link-listing series .  Also check out my ASP.NET Tips, Tricks and Tutorials

  • I'm slowly recovering from keynoting at MIX last week, and have been digging my way out of backlogged

  • I'm slowly recovering from keynoting at MIX last week, and have been digging my way out of backlogged

  • I'm slowly recovering from keynoting at MIX last week, and have been digging my way out of backlogged

  • I knew it was possible, was wondering if or when it would be available. JQuery Intellisense.

  • We use prototype.js and have been using it for years now. I love the intellisense for js and it's too bad it doesn't work for prototype.

    But is it a flaw in prototype.js or VS? Can the prototype crew fix this themselves?

  • @Tommy: It's something we're plan on fixing in VS.  I mentioned it here: http://blogs.msdn.com/webdevtools/archive/2008/03/12/jscript-intellisense-working-with-ext-js.aspx.  Thanks!

Page 3 of 4 (51 items) 1234