It Just Makes Sense

JScript IntelliSense in Visual Studio 2008

From the Source


It Just Makes Sense

JScript IntelliSense in Visual Studio 2008


By Erik Reitan


If you develop with Silverlight, ASP.NET AJAX, or ECMAScript (JScript or JavaScript), you ll like the rich support that Visual Studio 2008 offers with JScript IntelliSense. JScript IntelliSense helps you code faster by providing context-sensitive coding elements as you type your code but there s more to it than that. You can save time by selecting coding elements, and you can avoid errors by using IntelliSense. Essentially, JScript IntelliSense offers in JScript the IntelliSense with which you ve become familiar in managed code.


Creating full IntelliSense for JScript has been problematic to develop, because JScript is a language that features dynamic typing. However, Visual Studio 2008 provides the solution. In addition to displaying the programming elements you expect, JScript IntelliSense lets you add code descriptions that IntelliSense will display when you code or when anyone develops Web applications with your code. Adding your own JScript IntelliSense details and comments is especially useful if you re developing a client-script library.


It s important to note that JScript is the name for Microsoft s implementation of the ECMAScript client scripting language, which is often referred to as JavaScript. Like JScript, JavaScript and ECMAScript are supported by IntelliSense in Visual Studio.


IntelliSense Background

Before Visual Studio can provide JScript IntelliSense, the JScript IntelliSense engine must scan a project to determine what client code is available (based on files and on code links in the project). This scanning process creates the current coding context on which IntelliSense suggestions are based.


By default, the JScript IntelliSense context is generated on idle in Visual Studio or Visual Web Developer Express, but you also can manually invoke it. The context can be manually generated by selecting Edit | IntelliSense | Update JScript IntelliSense.


Understanding the IntelliSense Context

The JScript IntelliSense engine determines the coding context by scanning your current file, script file references, assembly script references, client-side Web service references, and page references. The script used to establish the IntelliSense context within Visual Studio includes:

  • JavaScript functions contained in the current

    Figure 9: Referencing a JavaScript file by setting the src attribute of the