JScript IntelliSense in Visual Studio Orcas

JScript IntelliSense in Visual Studio Orcas

The March CTP of Visual Studio marks the debut of a much-requested and long-awaited feature: improved JScript IntelliSense.  We’ve been working on this for almost a year now and I’m pretty excited to finally be able to share it with the public.  There are a variety of topics I’d like to deep dive into, but for today let’s just take a quick aerial tour of the new features.

1. Proactive Completion List

Our old list was a bit lazy and only “awoke” when you typed a period while accessing a member.  Our new one is on-its-toes and is wired up to the language grammar.  Net effect: it comes up when you would expect it, and you can spend less time pressing ctrl+J. =)

2. Keywords in Completion List

In practice, you will spend half of your time typing keywords.  Now they’re part of the list.

3. ASP.NET AJAX Concepts in Completion List

We have new glyphs corresponding to objects and functions that have registered themselves as ASP.NET AJAX Namespaces, Classes, Interfaces, Properties, Enumerations, etc.  Since lists are usually long, this is particularly useful for quickly discovering that particular member you’re looking for.

The glyphs are aligned with the ones you would see in managed programming.  Vanilla fields and functions are now just marked as blue and magenta boxes respectively.

4. IntelliSense from Script Libraries for ASPX Pages

The cornerstone feature is the new ability to see objects and functions declared in external script files.  Note below that $addHandler was not defined in the current document:

How do we know which files you’re referencing?  We look for Script Managers (and Proxies), and infer what scripts it will bring into the page:

We look for the normal HTML script reference tags:

We also take into account any Master Pages that may contain any of the above.

5. IntelliSense from Script Libraries for JS Files

The example above works great for pages, but what if you’re in a JS file?  Since there’s no standard syntax, we decided on the following XML comment syntax (which you’ll see a parallelism in the next section):

The above declaration simply states that the current JS file should display IntelliSense including objects and functions declared in JScript1.js.  The following declaration references a script library embedded within an assembly (note the subtle usage of “name” instead of “path”):

If the “assembly” attribute is left out, we assume it to be the System.Web.Extensions assembly.  This keeps standard references to ASP.NET AJAX scripts succinct.

It’s worthwhile to remember that these declarations must be found at the top of the page before any script or any regular comments.  Additionally, these declarations are not used during the runtime in any way—they are for the editor only.

6. Enhanced Function and Parameter Tips

Function and parameter tips now have the ability to show ASP.NET AJAX type information as well as summaries.  This should help minimize context-switching when looking for documentation.  Tips appear both from the completion list:

…and underneath the function as you’re typing:

Where is this information coming from?  The editor simply reads the XML comments from the source code:

ASP.NET AJAX employs a XML documentation comment scheme akin to the .NET XML Documentation Comments.  As long as your sources are commented, we leverage them to display the additional information.  ASP.NET AJAX scripts and AJAX Control Toolkit scripts come in commented flavors.  For older files that don’t have these comments, we will still show at least the function name and parameter names.

7. Type Inferencing

A foundational feature enabling much of the IntelliSense is our ability to infer types across assignments between JScript variables—which are inherently type-less.  The JScript Team, our partner team, has a great post on this topic.  I’ll defer the discussion of this feature to them.

Summary

JScript IntelliSense is a (purposefully) subtle set of features.  I hope this introduction spotlights some of the functionality you might otherwise have missed and gets you up and running.  I’ll blog in more depth later.  For now, have fun playing with the March CTP and let us know what you think!

Jeff King
Program Manager
Visual Studio Web Tools

Posted: Friday, March 02, 2007 2:25 AM by WebDevTools

Comments

Atlas and more said:

This is an absolutely awesome feature. IntelliSense / autocompletion for JavaScript is a difficult problem

# March 2, 2007 5:09 PM

Top ASP.NET Items said:

This is an absolutely awesome feature. IntelliSense / autocompletion for JavaScript is a difficult problem

# March 2, 2007 6:09 PM

Dave said:

I am REALLY looking forward to this.

Will the functionality be included in the "express" version as well?  If the free tools establish an industry leading JavaScript IDE right now while AJAX is so popular, I think it would win a lot of new developers over to .NET.

# March 2, 2007 7:13 PM

WebDevTools said:

Hi Dave,

Yes all of the new functionality for JScript Intellisense will be in VWD Express "Orcas" as well.

Glad you like it!

Omar Khan

Group Program Manager

Visual Studio Web Tools

# March 2, 2007 7:29 PM

foobar said:

Awww yeah.  That's the shiznit.

# March 2, 2007 7:38 PM

srijan said:

Fantastic to see this feature in Orcas.  I can't wait to try this out.

# March 3, 2007 2:13 AM

rbirkby said:

How does the intellisense functionality cope with private members, properties and fields? (ie prefixed with underscore). Are there any other prefix characters for "internal to a component" scoping? How about public fields? What happens if a member is added dynamically to the object hashtable? ie myclass.prototype["mymethod"]=function() {...};

# March 3, 2007 7:46 AM

David Boschmans Weblog said:

Yesterday I listed ASP.NET AJAX as one of the technologies discussed. During my talk I mentioned that

# March 3, 2007 4:26 PM

WebDevTools said:

Hi Rbirkby,

ASP.NET AJAX registered components that are in external files will automatically have their private members (those with an underscore prefix) hidden.  Those not registered or in the current file will have no hiding.

Members added to the object hashtable in lines of code that are executed will be seen as part of the object.  Those that are added inside the file usually will not (there are certain cases that will work depending on how and where you declare it).

Of course, what I'm describing is the intended design.  The Feb CTP is just a preview and there may be bugs may change this behavior.

HTH,

Jeff

# March 3, 2007 4:37 PM

Mike said:

Looks good!

I don't know if comments for your editor are such a good idea. Can't you keep a list of all js resources in the solution? The comment loses all value when the file is not viewed in Visual Studio.

Also, how wel does the intellisense work with other JS libraries? These usually have other ways of implementing namespaces (if at all) and many of them use jsdoc for their comments. So will you be able to see that in intellisense as well? (Hint: Aptana looks to be really good in doing that.)

Keep up the good work!

# March 3, 2007 5:50 PM

More Wally - Wallace B. McClure said:

I just read this over on Jeff's blog about Javascript Intellisense in the March CTP. Awesome...........Url:...

# March 3, 2007 10:10 PM

Wallace B. McClure said:

I just read this over on Jeff's blog about Javascript Intellisense in the March CTP. Awesome...........

# March 3, 2007 10:38 PM

Steve said:

All those comments will make larger js libraries.

# March 4, 2007 3:14 PM

WebDevTools said:

Hi Steve,

It's true those comments will make larger libraries.  I would recommend keeping a set of "release" scripts (compressed, obfuscated) and a set of "debug" scripts (fully commented, formatted).  If these's scripts are referenced via the Script Manager, we will automatically look for the debug versions of the script (via the extention .debug.js).

HTH,

Jeff

# March 4, 2007 9:51 PM

anon said:

Will other js library be supported?

For example dojo declares class using this syntax...

dojo.declare("namespace.class", parent.class, {

functionname : function(){}

});

# March 4, 2007 10:46 PM

坚强2002 said:

Thisisanabsolutelyawesomefeature.IntelliSense/autocompletionforJavaScriptisadifficultp...

# March 4, 2007 11:25 PM

WebDevTools said:

Looks like there were some questions about dojo and jsdocs support.  There are no current plans to support those.  We have a few more general Javascript/JScript goals that we want to meet such as formatting and even maybe compressing/"crunching".  After that, we can look at more specific features.

# March 5, 2007 1:09 AM

Valeri Hristov said:

Do you have plans for releasing a tool which will extract the comments from the JS files, e.g. for documentation purposes?

TIA

# March 5, 2007 3:04 AM

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# March 5, 2007 9:36 AM

jsp said:

I have downloaded the March CTP release and tried to get the intellisense to work with no avail.  I can't get a propety on a custom object to show up in the intellisense. I also can't get the tooltip data to show either. Can you write up a simple example on how to get this to work?  Here is my code I was trying to get to work.

<code>

/// <reference path="JScript1.js />

function init()

{

   var testobject = new test("hello");

   alert(testobject.property1);

}

function test(txt)

{

/// <summary>

///     A test function

/// </summary>

/// <param name="txt" type="String">

///     This is a string

/// </param>

/// <returns type="none" />        

   this.property1 = txt;

}

</code>

# March 5, 2007 11:50 AM

Michael Stuart said:

Now this is what I've wanted for years! :)  Orcas can't be completed fast enough for me!  Thanks for the quick rundown on the new javascript features.

# March 5, 2007 1:26 PM

Randy Edmunds said:

How is performance? VS 2005 C++ Intellisense updating is so bad that I had to disable it to be able to get any work done. That must be fixed before piling more features on top of it.

# March 5, 2007 1:48 PM

WebDevTools said:

Hi Randy,

This feature is not related to VS 2005 C++ intellisense since the code for JScript intellisense is completely separate.  We have already done our initial performance analysis and made some improvements based on this.  If there are situations where you find the performance is not up to the mark, send us those cases and we'll look to fix them before we ship Orcas.  Getting this kind of feedback early is actually one of the main reasons to release this early CTP.

Thanks,

-- Bash

# March 5, 2007 3:31 PM

WebDevTools said:

Hi Valeri,

With regards to your question the doc generation tool, see this link: http://weblogs.asp.net/bleroy/archive/2006/05/01/ScriptDoc_3A00_-document-your-Atlas-classes.aspx

HTH,

Jeff

# March 5, 2007 5:54 PM

Valeri Hristov said:

Jeff, thank you very much!

# March 6, 2007 6:00 AM

Sys_Admin said:

This is great but when I try to reference javascript file, TypeLibBuilder.exe crashes. Is there any workaround? Or maybe it's my installation problems?

# March 6, 2007 7:27 AM

Ayende Rahien said:

I would like to re-iterate the question about other js libraries.

This is extremely important.

# March 7, 2007 2:44 PM

WebDevTools said:

Hi Sys_Admin, we realized that there's actually a bug where the TypeLibBuilder.exe isn't signed properly thus causing this crash.  I'll be making a post soon to on how to fix it.

Hi JSP, one characteristic of the XML Comments is that is only works for externally referenced scripts. Currently for the active document, we don't have the ability to parse out the comments... only our engine that processes external documents has the know-how to read XML comments.  It's wasn't easy to get the current doc to recognize comments (otherwise we would have done so), but if this becomes a critical need, we can revisit this issue.

Thanks for your patience,

Jeff

# March 7, 2007 3:19 PM

WebDevTools said:

Hi Ayende,

While I can't promise we'll have support for any other js libraries, I'd like to get an idea from you (and everyone else reading) which libraries you feel are the most important that we support (in priority order).  We'll definitely take the information in to account as we plan for the future.

Thanks,

Jeff

# March 7, 2007 3:23 PM

Rodrigo said:

I think support for JsDoc comments should be seen first ,since its is used by most libraries out there.

I would like to see support for the yahoo library.

# March 7, 2007 4:00 PM

Adrian said:

just what i've been waiting for, so many hundreds of thousands of manually typed javascript lines later :)

# March 7, 2007 6:42 PM

Amberite said:

I'm having a problem with the JS intellisense in Orcas. When I put in the <reference> tags at the top of my file, the IDE says at the bottom "Generating client side script intellisense information from external script services..." However, this keeps going on forever until I press Escape or I switch files, at which point it stops. Needless to say, I do not get any intellisense information from the files I referenced. Why is this happening?

# March 9, 2007 1:03 PM

WebDevTools said:

Hi Amberite,

I'd have to look at the script files to diagnose what's going on.  If you don't mind sharing your scripts, I'll try to reproduce the issue and see what we can do.  My email is jking@microsoft.com.

# March 9, 2007 3:42 PM

Your Websites, Our Passion! said:

Jeff King made a recent post to show off the new JScript IntelliSense feature in the March CTP of Visual

# March 9, 2007 6:35 PM

Ric said:

Is there any information how to fix the TypeLibBuilder.exe crash?

# March 10, 2007 2:17 AM

PeteL's Blog said:

Up until now, we've never had a great set of JavaScript debugging tools, but "Orcas", the next version

# March 13, 2007 9:20 PM

Top ASP.NET Items said:

Up until now, we've never had a great set of JavaScript debugging tools, but "Orcas", the next version

# March 13, 2007 10:26 PM

Steve said:

great work - this is fantastic.

Does this intellisense work in an externally referenced .js file?

I've been talk since I could walk to not put code in the html  :)

# March 13, 2007 11:45 PM

WebDevTools said:

Hi Steve, intellisense works in an externally referenced .js file.  See point #5.  Thanks!

# March 14, 2007 1:34 AM

Luis Abreu said:

This is cool, but what i'd really like to see is an auto-formatter for js code...

# March 14, 2007 2:51 PM

WebDevTools said:

Hi Luis, I can't promise the formatter but I can say we're working on it.  It's #2 on our list second to validation.

# March 14, 2007 4:27 PM

Col said:

I have to agree that JsDoc support should be the first priority (when considering other libraries), as it is used by many other libraries, AFAIK.

Personally, i'd like to see Dojo support

# March 15, 2007 1:33 PM

Joel Rumerman said:

What do you mean by validation?

Argument validation for methods or something completely different?

Thx!

# March 17, 2007 5:48 PM

WebDevTools said:

Hi Joel, by "validation" i meant syntax checking.

# March 20, 2007 8:17 PM

Brad Abrams said:

I had a great time this morning doing the closing keynote… I talked about how great, productive Ajax

# March 21, 2007 1:30 PM

Millers said:

Hi - I cant find your reply to JSP requesting intelliSense support for custom objects?

I can't get that to work eigther.

Can't find support for my html objects - That worked well in VS2005 (i.e: someTable.insertRow() or someObj.style.... - does not seem to work?)

Missing intelliSense for normal things like window.showModalDialog...

Finally I would like to be able to Collapse functions like normal VS programming.

# March 25, 2007 6:20 AM

Millers said:

var d = new Date()

d.setFullYear(1992,10,3)

There is no intelliSense for built in Date object

# March 25, 2007 7:34 AM

Millers said:

Comment/uncomment (ctrl+k+c) does not work in jscript files

# March 25, 2007 8:45 AM

かるあ のメモ said:

JScript IntelliSense in Visual Studio Orcas (Your Websites, Our Passion!)より Orcas での JScript のインテリセンスサポートについて記述されています。

# March 27, 2007 1:04 AM

Mike Ormond's WebLog said:

I came across a couple of great blog posts about details of the JavaScript support we can expect to see

# April 16, 2007 9:02 AM

ASP.NET Podcast said:

Subscribe Download WMV. Show Notes: Orcas Beta 1. Javascript Intellisense. Javascript Debugging. http://blogs.msdn.com/webdevtools/archive/2007/03/02/jscript-intellisense-in-orcas.aspx

# April 22, 2007 7:39 PM

More Wally - Wallace B. McClure said:

Subscribe Download WMV.View in Flash Show Notes: Orcas Beta 1.Javascript Intellisense.Javascript...

# April 22, 2007 7:48 PM

Helen said:

What about javascript that's embedded in custom controls? Are there any plans to have a look at the components that are referenced by the page and provide intellisense for javascript files that are embedded into the controls as web resources?

# April 23, 2007 5:45 AM

Atlas and more said:

Xml documentation annotations are going to drive JavaScript IntelliSense in Visual Studio Orcas (the

# April 23, 2007 9:18 PM

Don Pavlik said:

I have not tested out some advanced JavaScript features with the Orcas CTP, but would like to know will it support truely private variables and private methods when you writing another private method?  ie.

myObject = function() {

 var m_MyPrivateString = "This is private";

 function privateStringHasIs() {

   // code here

 }

 return {

   // public methods and/or variables

   showString : function() {

     alert( m_MyPrivateString );

   }

 }

}

So when I am building my object I want to have real access to the objects private methods and properties with intellisense.  

# April 23, 2007 11:51 PM

Sandcastle said:

Bertrand Leroy , a Software development Engineer, from AJAX team is currently representing Microsoft

# April 24, 2007 12:57 AM

ScottGu's Blog said:

In February I did a blog post called My "First Look at Orcas" Presentation . It provided a good summary

# April 24, 2007 3:25 AM

BusinessRx Reading List said:

In February I did a blog post called My "First Look at Orcas" Presentation . It provided a good summary

# April 24, 2007 5:01 AM

ASP.NET said:

In February I did a blog post called My "First Look at Orcas" Presentation . It provided a good summary

# April 24, 2007 5:37 AM

Ivan Mostacero Plasencia said:

Really excelent feature!!!!! Thanks :)

# April 24, 2007 9:16 AM

Ivan Mostacero vNext™ said:

Una de las preguntas que siempre me han hecho en las presentaciones que he tenido respecto a Ajax es

# April 24, 2007 9:44 AM

Ivan Mostacero vNext™ said:

Una de las preguntas que siempre me han hecho en las presentaciones que he tenido respecto a Ajax es

# April 24, 2007 9:45 AM

Ivan Mostacero vNext™ said:

Una de las preguntas que siempre me han hecho en las presentaciones que he tenido respecto a Ajax es...

# April 24, 2007 9:59 AM

hacked.brain said:

No JavaScript IntelliSense in Orcas Web *Application* Projects yet?

# April 24, 2007 7:27 PM

TheDotNetWay.Net said:

Una de las nuevas funcionalidades que nos ofrecerá la nueva versión de Visual Studio es el soporte Intellisense

# April 25, 2007 9:44 AM

Heath Stewart said:

Will Sandcastle be able to process these comments?

# April 25, 2007 1:13 PM

Fish Can Flying! said:

【原文地址】JavascriptIntellisenseinVisualStudio

# April 26, 2007 8:24 AM

Atteint de Javascriptite aigüe said:

L'une des principales innovations de Visual Studio Orcas est le support de l'IntelliSense pour JavaScript.

# April 29, 2007 7:22 PM

Atteint de Javascriptite aigüe said:

L'une des principales innovations de Visual Studio Orcas est le support de l'IntelliSense pour JavaScript.

# April 29, 2007 8:23 PM

Toni said:

I just downloaded Orcas Beta and I must say I love what you guys have done, especially with the JavaScript Intellisense. The only thing I would like to see that is missing is support for auto formating. It is one of the biggest weaknesses of the IDE and also one of the most important ones for anyone coding or trying to troubleshoot JavaScript.

# May 4, 2007 2:09 PM

TrackBack said:

其中一个殷切期盼的特性是Visual Studio Orcas对客户端Javascript Intellisense的支持(这个特性在免费的Visual Web Developer Express版本中也工作)。

# May 8, 2007 1:30 AM

Imran Qureshi said:

one thing that would be good is support for object oriented javascript i.e., javascript classes.  Same as I can use Class View for .net classes, i'd like to be able to use it for javascript classes.  Also a wizard for creating javascript classes would be good since the syntax is so screwy it takes me a while to get the syntax right - since javascript is not strongly typed it makes it harder.

# May 11, 2007 5:57 AM

Darryl Burling @ Work said:

Over the last week or so our team has been planning what we will be working on over the next 12 months.

# May 27, 2007 5:51 PM

Huan-Lin's Blog said:

我打算把一些學習 ASP.NET AJAX 時的一些小範例貼上來,一方面做個簡單記錄,一方面,或許有人會覺得有用(其實網路上的教學文章很多了,你可以多找一些來看,會學得更多更快)。由於都是些簡短的小練習,故取名「牛刀小試」,ASP.NET AJAX 的應用技巧相當多,若有時間,我會盡量多寫幾篇,把它當作一個系列來寫。

# June 17, 2007 12:15 AM

Chalalo Land said:

Navegando y navegando, me encontre con este interesante blog, nos habla de como hacer el debugging de

# July 24, 2007 8:52 AM

Your Websites, Our Passion! said:

In a previous post , I described the steps you can take to upgrade your existing ASP.NET AJAX 1.0-based

# July 30, 2007 12:07 AM

Noticias externas said:

In a previous post , I described the steps you can take to upgrade your existing ASP.NET AJAX 1.0-based

# July 30, 2007 12:57 AM

JScript Blog said:

Previous release of Visual Studio "Orcas" debuted the much awaited feature of Javascript intellisense.

# August 1, 2007 6:09 PM

Kirk Allen Evans' Blog said:

I am simply amazed at the JavaScript debugging with Visual Studio 2008. The really cool part is that

# August 10, 2007 12:20 PM

HD DVD / Randomness... said:

Forget being the best thing since sliced bread – this is the best thing ever . Well maybe not quite that

# October 2, 2007 2:49 PM

Noticias externas said:

Forget being the best thing since sliced bread – this is the best thing ever . Well maybe not quite that

# October 2, 2007 3:39 PM

雨過天晴 said:

Using VS 2008 to target ASP.NET AJAX 1.0

# November 2, 2007 8:34 PM

Your Websites, Our Passion! said:

It should be no surprise that JScript Documentation Comments power much of what you see in JScript IntelliSense

# November 6, 2007 2:32 PM

Noticias externas said:

It should be no surprise that JScript Documentation Comments power much of what you see in JScript IntelliSense

# November 6, 2007 3:00 PM

ProgrammingBookWorm said:

JScriptDebugginginVisualWebDeveloperOrcas

JeffKingmadearecentposttoshowoffthenewJ...

# January 14, 2008 8:30 PM
New Comments to this post are disabled
Page view tracker

posted on 2008-01-15 09:35  ProgrammingBookWorm  阅读(275)  评论(0)    收藏  举报

导航