{"id":4054,"date":"2008-10-28T14:30:00","date_gmt":"2008-10-28T14:30:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/2008\/10\/28\/rich-intellisense-for-jquery\/"},"modified":"2008-10-28T14:30:00","modified_gmt":"2008-10-28T14:30:00","slug":"rich-intellisense-for-jquery","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/rich-intellisense-for-jquery\/","title":{"rendered":"Rich IntelliSense for jQuery"},"content":{"rendered":"<p><P><STRONG>Update: A <\/STRONG><A href=\"http:\/\/blogs.msdn.com\/webdevtools\/archive\/2008\/11\/07\/hotfix-to-enable-vsdoc-js-intellisense-doc-files-is-now-available.aspx\"><STRONG>new Hotfix<\/STRONG><\/A><STRONG>&nbsp;is availble to complement this file.<\/STRONG><\/P>\n<P>A while back we <A href=\"http:\/\/blogs.msdn.com\/controlpanel\/blogs\/null\">updated VS2008 IntelliSense<\/A> to not fail when referencing jQuery.&nbsp; However, getting IntelliSense for chained calls and rich summary\/parameter hints still required adding special comments to a few thousand lines of jQuery.&nbsp; If you didn&#8217;t have the time, you could download such a file from friendly members of the community such as <A href=\"http:\/\/blogs.ipona.com\/james\/archive\/2008\/02\/15\/JQuery-IntelliSense-in-Visual-Studio-2008.aspx\">James<\/A> and <A href=\"http:\/\/brennan.offwhite.net\/blog\/\">Brennan<\/A>.<\/P>\n<P>As part of our new <A href=\"http:\/\/weblogs.asp.net\/scottgu\/archive\/2008\/09\/28\/jquery-and-microsoft.aspx\">partnership with jQuery<\/A>, yesterday we announced the availability of the official IntelliSense documentation file.&nbsp; As you can see, our friends at jQuery have added a new download link for Visual Studio at <A href=\"http:\/\/docs.jquery.com\/Downloading_jQuery#Download_jQuery\">http:\/\/docs.jquery.com\/Downloading_jQuery#Download_jQuery<\/A>.<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_4.png\"><IMG border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_thumb_1.png\" width=\"550\" height=\"100\"><\/A> <\/P>\n<P>You can also download the file directly from <A href=\"http:\/\/code.jquery.com\/jquery-1.2.6-vsdoc.js\">http:\/\/code.jquery.com\/jquery-1.2.6-vsdoc.js<\/A>.&nbsp; As you might guess, this documentation file corresponds with the latest version of jQuery (which is currently 1.2.6).&nbsp; While this file has a &#8220;js&#8221; extension, it&#8217;s really just a documentation file.&nbsp; You <B>do not<\/B> want to run this file in the browser.<\/P>\n<P><B>How do I use this file (today)?<\/B><\/P>\n<P>If you&#8217;re inside an ASPX page, you will need to add the following lines of code into (normally) the head of your page:<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_8.png\"><IMG border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_thumb_3.png\" width=\"550\" height=\"80\"><\/A> <\/P>\n<P>Why do we have a server-side conditional statement?&nbsp; IntelliSense disregards conditional statements of this type, and thus loads the &#8220;vsdoc&#8221; file (overriding the normal one).&nbsp; At runtime the if (false) statement will ensure it this documentation file is not rendered (and executed) as script.&nbsp; This trick allows the &#8220;switching&#8221; behavior you want.<\/P>\n<P>If you&#8217;re in a JavaScript file, use the normal <A href=\"http:\/\/blogs.msdn.com\/webdevtools\/archive\/2007\/11\/06\/jscript-intellisense-a-reference-for-the-reference-tag.aspx\">file reference syntax<\/A> to refer to the &#8220;vsdoc&#8221; file.<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_10.png\"><IMG border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_thumb_4.png\" width=\"550\" height=\"40\"><\/A><\/P>\n<P>There&#8217;s no need for tricks here since this comment is only meaningful to IntelliSense.<\/P>\n<P><B>How do I use this file (in the near future)?<\/B><\/P>\n<P>The ideal user experience should be one where you do not need special tricks as mentioned above.&nbsp; Really, you shouldn&#8217;t need to mention the &#8220;vsdoc&#8221; file name at all.&nbsp; To that end, we plan on releasing a Hotfix that will enable this (stay tuned!).&nbsp; Given normal references such as&#8230;<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_14.png\"><IMG border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_thumb_6.png\" width=\"550\" height=\"40\"><\/A>&nbsp;<A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_16.png\"><IMG border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_thumb_7.png\" width=\"550\" height=\"40\"><\/A> <\/P>\n<P>&#8230;IntelliSense will opportunistically search for &#8220;jquery-1.2.6-vsdoc.js&#8221; and load that file instead.&nbsp; Generally, given script name &#8220;x&#8221;, IntelliSense will opportunistically search for &#8220;x-vsdoc.js&#8221;.&nbsp; If not found, it will then search for &#8220;x.debug.js&#8221;.&nbsp; You just need to make sure to place your &#8220;vsdoc&#8221; file next to the normal file.&nbsp; Note, if you use jquery-1.2.6.<B>min<\/B>.js, you may need to rename the file to match the search pattern.<\/P>\n<P><B>What are the advantages of this file?<\/B><\/P>\n<P>One unique benefit of the file we have released is that it supports and understands jQuery plug-ins.&nbsp; For example, given the plug-in below&#8230;<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_22.png\"><IMG border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_thumb_10.png\" width=\"550\" height=\"100\"><\/A> <\/P>\n<P>&#8230;you would see &#8220;myplugin&#8221; show up in IntelliSense.<\/P>\n<P><A href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_18.png\"><IMG border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/16\/2019\/02\/image_thumb_8.png\" width=\"550\" height=\"200\"><\/A> <\/P>\n<P>We&#8217;ve noticed a few plug-ins do not work, and commonly this is because there is an IntelliSense incompatibility issue with the plug-in itself (as opposed to the jQuery documentation file).<\/P>\n<P>Hope this helps!<\/P>\n<P><B>Jeff King<\/B> <BR>Program Manager <BR>Visual Studio Web Tools<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update: A new Hotfix&nbsp;is availble to complement this file. A while back we updated VS2008 IntelliSense to not fail when referencing jQuery.&nbsp; However, getting IntelliSense for chained calls and rich summary\/parameter hints still required adding special comments to a few thousand lines of jQuery.&nbsp; If you didn&#8217;t have the time, you could download such a [&hellip;]<\/p>\n","protected":false},"author":404,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[197],"tags":[7279,7265,31,7276,7277,7274,7303,147,7302],"class_list":["post-4054","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aspnet","tag-ajax","tag-announcements","tag-asp-net","tag-intellisense","tag-jeff-king","tag-jscript","tag-sp1","tag-visual-studio","tag-visual-studio-2008"],"acf":[],"blog_post_summary":"<p>Update: A new Hotfix&nbsp;is availble to complement this file. A while back we updated VS2008 IntelliSense to not fail when referencing jQuery.&nbsp; However, getting IntelliSense for chained calls and rich summary\/parameter hints still required adding special comments to a few thousand lines of jQuery.&nbsp; If you didn&#8217;t have the time, you could download such a [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/4054","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/404"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=4054"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/4054\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=4054"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=4054"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=4054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}