IntelliSense for JavaScript

JavaScript IntelliSense in Visual Studio 2010 provides coding choices based on all script that is relevant to your current programming context. This includes scripting elements in the current file. It also includes any code that is referenced directly or indirectly from your script, such as script file references, assembly script references, service references, and page-associated references.

The JSense way

The JSense extension helps you keep your script file references up do date by searching for script files (.js), services (.asmx) and pages (.aspx) in your project and adding them to a common meta base file.

Simply right-click your project and select JSense and your script references for IntelliSense are up-to-date!

Visual Studio 2010 vs. Visual Studio 11

This extension was initially developed for Visual Studio 11 Beta where IntelliSense for JavaScript is far more mature. JSense for VS2010 WILL provide some help with IntelliSense but will not make up for the basic shortcomings of VS2010 IntelliSense.

I recommend trying Visual Studio 11 Beta with JSense for a much more user friendly experience.

Running JSense for the first time

When JSensing a project for the first time a file named @JSense.js will be created in the project root. This is your reference meta base that contains all script file references and exclusions.

By default JSense will exclude minified script files (.min.js) services (.asmx) and pages (.aspx). To include these in the meta base simply remove the /// <JSense exclude="..." /> tags and re-run JSensing.

If you examine you script files in VS 2010 you will notice that the following tag has been added to the top of the script:

/// <reference path="/@JSense.js" /> 

This tag will tell Visual Studio to look in the meta base for references that should be included in IntelliSense for the current script file.

In Visual Studio 11 JSense adds an implicit reference to @JSense.js in the IntelliSense configuration thus removing the need for references in each individual script file.

Working with exclusions

Sometimes you wish to exclude specific files, file types or entire directories from IntelliSense. To do this you may add your own exclusion tags to the meta base. An exclusion tag evaluates a .Net Regular Expression on the full file path and name. If the expression evaluates true the file is excluded.

For example consider a script in the \scripts\foo directory called foo.js with the full path /scripts/foo/bar.js

Exclude bar.js: /// <JSense exclude="/scripts/foo/bar\.js" />

Exclude all files (and sub dirs) in foo: /// <JSense exclude="/scripts/foo/.*" />

Exclude all script files NOT marked debug<JSense exclude=".*[^\.debug]\.js" />