Visual Studio 2008: Making (Intelli)sense of JavaScript

Published
Sunday, August 03, 2008 10:44 AM

We are all masters of efficiency. We ditched snail mail in favor of email. We do not try to remember the links we favor, instead we digg, kick, twitter, bookmark; We do not type web addresses, we search, when we search, we rely on word suggestions, past searches ... How convenient.

ASP .net intellisense to ASP .net programming is Google Suggest to google search. In visual studio 2005 and its precessors, we have very nice intellisense support on the server side. Very smart too.

However with Javascript, intellisense is barely there. This is painful, since the world has turned and now the web wants to be predominantly JavaScript driven and client centric with the server's role be limited to mainly data provider.

The good news is that Visual Studio 2008 has started to provide enormous support of Intellisense for JavaScript; the bad news is, not enough. But better use it than lose it.

Intellisense for Common JavaScript Keyword, Classes, Standard method

For example, if you type document, you will have the immediate suspects at your fingertips. Nice.

However, since JavaScript is a non-typed script language, that means, there is no type declaration, string vs int, so there is no intellisense support for string functions or math functions. Sort of like you do not have not declare you are female, male, animal or human being, therefore there is no predication the kind of behavior.

Intellisense for ASP .NET AJAX JavaScript extensions

$ sign is probably the very magic symbol in ASP .NET AJAX. $get is shortcut for Document.get(""), $addHandler for Sys.UI.DomEvent.addHandler. So whenever you type a $, Intellisense will intantaneously fill in with all of the suspects. One catch is that you must first drag and drop a ScriptManager control to page so Intellisense will know the presense of ASP .NET AJAX

Intellisense for external JavaScript

If you drag and drop an external JavaScript to your page, Intellisense will make an informative guess and lend you with its intelligence.

field: "The field tag (which doesn't exist in C# and VB.NET because in those languages the summary tag can be used) is used inside of a class, interface or enumeration constructor to describe a field." (Betrand Le Roy)