Tuesday, April 29, 2008

JavaScript Intellisense - Orcas New Features


This blog post summarizes the new features of ASP.Net 3.5 and VS 2008 IDE.

Below are the new features been introduced.

§ VS 2008 Multi-Targeting Support

§ VS 2008 JavaScript Intellisense

§ VS 2008 JavaScript Debugging

§ VS 2008 Code Editing Improvements

§ VS 2008 Nested Master Page Support - - Nothing to add. Read Post.

§ VS 2008 Web Designer and CSS Improvements

§ VS 2008 Vertical Split View Support - Nothing to add. Read Post.

§ VS 2008 ASP.NET AJAX Control Extenders

§ ASP.NET ListView Control (Part 1: Building a Product Listing Page with Pure CSS)

§ ASP.NET AJAX in .NET 3.5 and VS 2008

Before we go further let’s have a quick view.

Compatibility - From VS 2005 to VS 2008 and .NET Framework 2.0 to 3.5?

Though .NET Framework 3.5 is a super compatible upgrade from .NET 2.0, it does not require you to change any code in order to target the new framework version. Only non-breaking modifications to existing .NET assemblies have been made in the .NET 3.5 release, and wherever possible added new features in separate assemblies to minimize the chance of breaking changes.

Also no project model or build changes have been made with VS 2008. Both the "web site" and "web application project" models will be fully supported going forward.

JavaScript Intellisense

Here I have been putting major points on JavaScript Intellisense. For other details, how it works please folow the below link.


New features-

§ JavaScript Type Inference

§ Intellisense for External JavaScript Libraries - Refer the post link.

§ Adding Intellisense Hints to JavaScript

§ Calling Web Services using ASP.NET AJAX - Refer the post link.

§ Creating Re-Usable ASP.NET AJAX Behaviors, Controls and Libraries - Refer the post link.

JavaScript Type Inference

JavaScript is a dynamic language, and doesn't support explicit type declarations, which has made implementing good intellisense difficult in the past.

Visual Studio 2008 adds support for Type Inference, which means that it evaluates and computes how a JavaScript block is being used and dynamically infers the variable usage and type information of the code to provide accurate intellisense support.

i.e the intellisense is provided based on the value assigned to the variable.

Adding Intellisense Hints to JavaScript

Visual Studio will automatically provide basic intellisense help information for the method name and parameters of standard JavaScript. This intellisense can optionally make this intellisense richer by adding comments to your JavaScript code that the intellisense engine can then pick up and use when you consume a method or library.

For .eg. Assume below function is placed in Util.js file

function getMessage(name){

/// <summary> This method returns a greeting message</summary>

/// <param name="name">Persons Name</param>

/// <returns>string</returns>

return 'Hello';


Now if we use this above in our .aspx we’ll get the intellisese help.

Note: This hints intellinses is only provided for only those function which have been placed in separate .JS files. i.e If the same function as placed above, is present in .aspx itelf and the time we use it, no Hints Intellinsense will be provided.

Hope this helps.

Thanks & Regards,

Arun Manglick || Tech Lead

No comments:

Post a Comment