SharePoint 2010 ECMAScript/Javascript Intellisense in Visual Studio

Tags: SharePoint 2010

If you are a developer and live somewhere not under a rock, you know that Visual Studio now supports intellisense (and has since late in the VS2008 lifecycle).

This is pretty sweet for developing with frameworks like jQuery and (hence this post) the SharePoint Client Object Models.  If you are in an external .js file (which is where I like to put most of my scripts) then you simply need a few lines of code at the top:

/// <reference path="C:\Program Files\Common Files\Microsoft Shared\Web 
                        Server Extensions\14\TEMPLATE\LAYOUTS\MicrosoftAjax.js" />
/// <reference path="C:\Program Files\Common Files\Microsoft Shared\Web 
                        Server Extensions\14\TEMPLATE\LAYOUTS\SP.debug.js" />
/// <reference path="C:\Program Files\Common Files\Microsoft Shared\Web 
                        Server Extensions\14\TEMPLATE\LAYOUTS\SP.Core.debug.js" />
/// <reference path="C:\Program Files\Common Files\Microsoft Shared\Web
                        Server Extensions\14\TEMPLATE\LAYOUTS\SP.UI.Dialog.debug.js" />

This will get you most of the intellisense that you care about… if something looks like its missing… make sure you are referencing the correct .js files… a list for the appropriate ones by class/namespace can be found here.

Cheers.

edit: fixed the code not showing up… twice… ok, I had to break it up on multiple lines so it could be read, but... it works...

Add a Comment