VS 2008 JavaScript Intellisense for Silverlight

In addition to shipping VS 2008 and .NET 3.5 Beta 2 last week, my team also shipped the first release candidate of Silverlight 1.0 (it was a busy week at the office!).  You can download the Silverlight 1.0 RC here.

I blogged about our Silverlight plans and roadmap a few months ago.  This first Silverlight 1.0 release is focused on enabling rich media scenarios, and delivers high quality video and audio streaming and XAML based vector graphics and animation support in the browser.  Silverlight is cross browser and cross platform, and can be easily added to any HTML page.  Silverlight 1.0 supports a JavaScript programming model that makes it easy to integrate into an AJAX based page experience (note: Silverlight 1.1 will then add a cross-platform .NET framework programming model and enable RIA support).

JavaScript Intellisense for Silverlight 1.0

Over the last few weeks I've blogged about the new VS 2008 JavaScript Intellisense and VS 2008 JavaScript Debugging features in Beta 2.   In addition to using these JavaScript tooling features when building pure HTML AJAX solutions, you can also now take advantage of them when targeting Silverlight 1.0.

Justin-Josef Angel earlier today released an awesome Silverlight 1.0 JavaScript Intellisense CodePlex Project that helps dramatically with this.  It includes some nice annotated JavaScript helper methods that provide the ability to work with any XAML element in Silverlight with full intellisense in VS 2008. 

To use it, simply add his JavaScript library to the top of your page:

You can then use Justin's helper functions to take late-bound objects and indicate their JavaScript type:

This will then cause the VS 2008 JavaScript intellisense engine to automatically provide intellisense and syntax checking for you:

You can learn all about Justin's library via his excellent tutorial post here.  You can then download and participate in the codeplex project here.

Hope this helps,

Scott

P.S. All of the intellisense features above work in both VS 2008 as well as the free Visual Web Developer 2008 Express Edition.

23 Comments

  • VS 2008 intellisense features are great for developers. Especially the one for javascript.

  • Very nice and extremely useful!

  • Oh, man... You inspired me to use Lucida Console for coding, and now you're switching to Courier New! Traitor!!! :-)

  • Really nice with a new VS2008 blog post almost every day. It really drives the motivation to look at your new stuff!

  • Cool. Is this js file only for development? Should I remove it when the page deliver?

  • Fisher,

    There are two possiable deployment options for the "intellisense.js" file - you either deploy it or you don't.
    If you deploy it, it's best you used the compressed version. One is supplied with the download.
    If you decide not to deploy it, You'll have to convert all your Intellisensed code to non-intellisense code with the tool provided in the full download (or use something like HttpHandler to filter out all your intellisense content to non intellisensed content).

    I've explained about this issue in detail on the blog post scott linked to. Look up "deployment" near the end of the article.

  • Thanks Scott!
    I am really enjoying the IDE, you guys did a great job with it, and hope to get into some Silverlight development within the next few days.

  • thansk for the post. Is the new version of silver light supporting windows 2000 server

  • Hi Scott

    Maybe I missed this one, but anyway... Will there be a designer for Silverlight pages in VS 2008?

    Thanks
    Gill Cleeren

  • Thanks Justin Josef Angel.
    I'll try it in my 1.0 application demo.
    Best regards,
    Fisher Ning
    MSN Media Solutions.

  • Hi Scott,

    Will a special intellisense file be required to support the AJAX control toolkit for example?
    Also will the type inferring logic support AJAX components? Consider the following scenario:
    var modalPopup = $find("ModalPopup1");

    In this case will the type inferring engine guess that modalPopup is a AjaxControlToolkit.ModalPopupBehavior and show its hide/show methods?

    Also will the intellisense engine support script files registered programmatically through the ScriptManager control (as opposed to inline with ScriptReference tags)?

  • Hi Jonas,

    >>>>>> I did something like this a feew weeks back to get JavaScript intellisense for Vista Sidebar Gadgets. JavaScript and info over at: jonas.follesoe.no/PermaLink,guid,7070fb65-9563-476c-b643-cf06cc04a7e7.aspx Perhaps I should get the code up on codeplex. Drop any feedback if this is something the community might find usefull.

    This looks very cool - thanks a bunch for putting it together!

    Scott

  • Hi Vikram,

    >>>>>>> thansk for the post. Is the new version of silver light supporting windows 2000 server

    The current builds of Silverlight don't support Windows 2000 yet on the client-side. Our roadmap in the future will support it though.

    Hope this helps,

    Scott

  • Hi Gil,

    >>>>>>> Maybe I missed this one, but anyway... Will there be a designer for Silverlight pages in VS 2008?

    We'll support a designer in VS in the future for Silverlight. Today we have an alpha build of Expression Blend that supports Silverlight, and then intellisense and debugging support inside VS 2008 Beta2 for Silverlight 1.1 (which has .NET support). A WYSIWYG designer inside VS 2008 will then come in the future.

    Hope this helps,

    Scott

  • Hi Atanas,

    >>>>>> Will a special intellisense file be required to support the AJAX control toolkit for example?

    That is a very good question. I just pinged the AJAX Control Toolkit team to see if they've thought of using the approach that Justin is above for their controls.

    Thanks,

    Scott

  • One more thing :)

    Resolving script references would be extremely beneficial for ASP.NET control vendors as well. I also would be easier for the user.

  • I just updated to RC1 and have tried to run a Sample (Page Turn), downloaded and run locally. I get an error. I've been told that I must update the silverlight.js file and make some other changes. Is there a URL where those changes are listed/described?

  • Hi Atanas,

    >>>>> What about my second question? Right now it seems that no one calls the IScriptControl.GetScriptReferences() method of the AJAX toolkit controls (tested with ModalPopupExtender) in design time. I think this is because the extender is registered during OnPreRender which does not fire in design time. I tried calling RegisterExtenderControl in OnInit but ended up with a nullreference exception thrown by it.

    Any chance you could send me an email (scottgu@microsoft.com) with this question? I can then loop you in with the intellisense folks to get an answer.

    Thanks,

    Scott

  • i wish Adobe could learn somthing from these extreme Intellisense features of VS2008 and add few in Flash CS3 :)

    // chall3ng3r //

  • Hi scott,
    We are planning to develop web application that uses silverlight wanted to know from you whether it supports Netscape 8,9 and Firefox 2.0.

  • Hi manjunath,

    >>>>>>> We are planning to develop web application that uses silverlight wanted to know from you whether it supports Netscape 8,9 and Firefox 2.0.

    I know we support FireFox 2.0, but I haven't tried Netscape 8,9 myself yet.

    Thanks,

    Scott

  • Hi Scott,

    What about VS 2005 ?
    There is any plan to put JavaScript Intellisense in VS 2005 ?

    If I can build Silverlight applications using notepad ... LOL... why not using VS 2005 with JavaScript Intellisense :o) ?
    I have to buy again new developer tool (VS 2008) ?

    Thanks

  • Hi rbfigueira,

    >>>>>> There is any plan to put JavaScript Intellisense in VS 2005 ?

    Unfortunately JavaScript intellisese is a really big feature, and so can't easily be ported/added to VS 2005. There are, however, cheap upgrade discounts to enable you to easily go from VS 2005 to VS 2008 without having to pay much money.

    Visual Web Developer 2008 Express Edition is also free and has JavaScript intellisense included.

    Hope this helps,

    Scott

Comments have been disabled for this content.