{"id":2844,"date":"2010-11-08T16:30:12","date_gmt":"2010-11-08T16:30:12","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/webdev\/2010\/11\/08\/how-to-solve-javascript-intellisense-problems-in-vs2010\/"},"modified":"2022-08-16T01:22:51","modified_gmt":"2022-08-16T08:22:51","slug":"how-to-solve-javascript-intellisense-problems-in-vs2010","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/how-to-solve-javascript-intellisense-problems-in-vs2010\/","title":{"rendered":"How to solve JavaScript IntelliSense problems in VS2010"},"content":{"rendered":"<p>VS2010 should support all of the VS2008 JavaScript functionalities as shown in Scott Guthrie\u2019s <a href=\"http:\/\/weblogs.asp.net\/scottgu\/archive\/2007\/06\/21\/vs-2008-javascript-intellisense.aspx\">VS2008 JavaScript IntelliSense blog<\/a>.&#160; It includes:<\/p>\n<p>1. Basic type inference<\/p>\n<p>2. IntelliSense from referenced external JavaScript libraries<\/p>\n<p>3. IntelliSense from XML comments for functions, parameters and return types<\/p>\n<p>4. Calling web services using ASP.NET AJAX<\/p>\n<p>&#160;<\/p>\n<p>Additionally, VS2010 RTM had some improvement, including:<\/p>\n<p>1. IntelliSense when manipulating browser objects<\/p>\n<p>2. Dynamic generated variable IntelliSense<\/p>\n<p>3. Default JavaScript snippets within IntelliSense to help you code faster<\/p>\n<p>Scott Guthrie has a brief <a href=\"http:\/\/weblogs.asp.net\/scottgu\/archive\/2010\/04\/08\/javascript-intellisense-improvements-with-vs-2010.aspx\">blog<\/a> covering some of these.<\/p>\n<p>&#160;<\/p>\n<p>Due to the dynamic feature of our JavaScript engine, we may run info conflicts between XML commented return types and inferred return types in some cases.&#160; For example:<\/p>\n<p>1. Dynamically generated IntelliSense will override the XML commented return types.&#160; <\/p>\n<p>&#160;&#160;&#160; For example, the following code snippet shows string IntelliSense, instead of number IntelliSense:<\/p>\n<blockquote>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2010\/11\/5516.image_thumb.png\"><img decoding=\"async\" style=\"border-right-width: 0px;float: none;border-top-width: 0px;border-bottom-width: 0px;margin-left: auto;border-left-width: 0px;margin-right: auto\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2010\/11\/5516.image_thumb.png\" width=\"395\" height=\"395\" \/><\/a><\/p>\n<p>This may lead to a confusing result sometimes.&#160; The best way to solve this is to create a vsdoc commenting file, and remove the conflicting return statement from such functions, just like jquery-1.4.1-vsdoc.js in VS2010 RTM:<\/p>\n<\/blockquote>\n<pre class=\"code\"><a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2010\/11\/4848.image_thumb_1.png\"><img decoding=\"async\" style=\"border-right-width: 0px;float: none;border-top-width: 0px;border-bottom-width: 0px;margin-left: auto;border-left-width: 0px;margin-right: auto\" title=\"image\" border=\"0\" alt=\"image\" src=\"https:\/\/devblogs.microsoft.com\/dotnet\/wp-content\/uploads\/sites\/10\/2010\/11\/4848.image_thumb_1.png\" width=\"428\" height=\"384\" \/><\/a> <\/pre>\n<p><a href=\"http:\/\/11011.net\/software\/vspaste\"><\/a><\/p>\n<p>2. Sometimes, the JavaScript engine may meet an exception internally during dynamic function execution in the current or referenced document.&#160; The cause could be a JavaScript function syntax error, logic bug, or the VS2010 JavaScript engine bug. The corresponding IntelliSense at this time will be shown as a simple object or not shown at all.&#160; To support good IntelliSense behavior in this case, try build a VSDoc file, add XML comments and remove the offending code.<\/p>\n<p>&#160;<\/p>\n<p>Some useful links:<\/p>\n<p><a href=\"http:\/\/weblogs.asp.net\/bleroy\/archive\/2007\/04\/23\/the-format-for-javascript-doc-comments.aspx\">Format of JavaScript doc comments<\/a><\/p>\n<p><a href=\"http:\/\/blogs.msdn.com\/b\/webdevtools\/archive\/2008\/11\/07\/hotfix-to-enable-vsdoc-js-intellisense-doc-files-is-now-available.aspx?wa=wsignin1.0\">VSDoc file look up orders<\/a><\/p>\n<p>&#160;<\/p>\n<p>Thanks<\/p>\n<p>Xinyang Qiu<\/p>\n<p>Web Platform and Tools<\/p>\n","protected":false},"excerpt":{"rendered":"<p>VS2010 should support all of the VS2008 JavaScript functionalities as shown in Scott Guthrie\u2019s VS2008 JavaScript IntelliSense blog.&#160; It includes: 1. Basic type inference 2. IntelliSense from referenced external JavaScript libraries 3. IntelliSense from XML comments for functions, parameters and return types 4. Calling web services using ASP.NET AJAX &#160; Additionally, VS2010 RTM had some [&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":[7276,7372,7274,7373],"class_list":["post-2844","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aspnet","tag-intellisense","tag-javascript","tag-jscript","tag-vsdoc"],"acf":[],"blog_post_summary":"<p>VS2010 should support all of the VS2008 JavaScript functionalities as shown in Scott Guthrie\u2019s VS2008 JavaScript IntelliSense blog.&#160; It includes: 1. Basic type inference 2. IntelliSense from referenced external JavaScript libraries 3. IntelliSense from XML comments for functions, parameters and return types 4. Calling web services using ASP.NET AJAX &#160; Additionally, VS2010 RTM had some [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/2844","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=2844"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/2844\/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=2844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=2844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=2844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}