More Javascript Intellisense with Visual Studio 2008 Beta 2


Previous release of Visual Studio “Orcas” debuted the much awaited feature of Javascript intellisense.  If you have not, you can read about it here, here and here.  Visual Studio 2008 Beta 2 further takes Javascript Intellisense to a whole new level.  Here, I want to briefly give an overview of the enhancements in Javascript Intellisense.


(1) Implicit declarations of variables


Now, variables declared implicitly without the use of the “var” keyword would be shown in the intellisense drop down as follows:


Implicit Declarations of Variables


 


(2) Support for member variables


Member variables would be added into the intellisense dropdown as and when they are declared:


Member variables


 


(3) Support for closures


Member variables defined in the constructor of an object using the “this” keyword will show up as members of the object.  This is illustrated in the example below:


 


 


(4) Support for prototype members


Member variables defined via the prototype object will be shown in the dropdown.



 


(5) Support for Object literals


Members variables defined through an object literal will now be shown in the intellisense dropdown.



 


(6) Intellisense on “this” keyword


When a user types “this.” inside a function, intellisense is now triggered listing the members defined earlier in the function.



In addition to this, a heuristic approach is adopted to associate the the “this” object where the function is assigned to a member variable of an object.  For instance, in the following example, when intellisense is triggered, the engine will try to associate the “this” object to the String.prototype object.



 


With these enhancements to intellisense, the user experience of writing Javascript in Visual Stusio 2008 Beta 2 is certainly bound to be much better compared to previous release.  These enhancements came as a result of numerous feedbacks and comments we received from the users of early releases.  So, we would love to hear your feedback and comments on this, do let us know.


 


Sameer Chabungbam
Program Manager
Jscript.DevTools


 


Comments (11)

  1. Looks really nice. Thanks a lot.

    Just a few questions. Does the lookup for prototype definitions works across multiple files e.g. definition in one file, usage in another one? Does the prototype inheritance also works when using a wrapper around this (like most JS frameworks do) e.g. <a href="http://demo.qooxdoo.org/current/apiviewer/#qx.Class~define">qx.Class.define</a&gt; in qooxdoo does.

    BTW: Does these features require to buy the full Visual Studio or will there be an Express Edition like for other stuff already released which also contains these nice things?

  2. don.raman says:

    Thanks for leaving your comment.

    Yes, the entire authoring support is available in Express Edition too. The Express edition for Visual Web Developer 2008 can be downloaded from the link given below:

    http://msdn2.microsoft.com/en-us/express/future/bb421473.aspx

    And yes we do support intellisense on functions/prototypes defined across file. Please look at:

    http://blogs.msdn.com/webdevtools/archive/2007/03/02/jscript-intellisense-in-orcas.aspx

    The bulleted point 4 and 5 in the blog above will give you a nice idea what user has to do to achieve this.

    If you have any further feedback/suggestion, please get back to us. Your suggestions will help us in improving the product further.

  3. @Don: Can you tell me if the prototype-stuff also works when using wrapper around the native prototype. This question was already part of my previous comment but it seems you have overseen it.

  4. Paul McConnon says:

    Is there any way to turn off intellisense per  file.

    For example prototype.js causes intellisense errors when used in a VS project, I’d like to be able to use hintes eg

    ///no_scan

    so that intellisense does not try and model the file.

    P

  5. Sameerch says:

    Hi Paul,

    There is no way to turn off intellisense if the file is referenced.  The only way to turn off intellisense selectively is not to refernce the file.  (Remove the <script src="…" > tag or the /// <reference …> tag)

    Having said that, I feel this is a very good feedback and we will take a look at this.  We do appreciate this.

    Sameer

  6. robert says:

    hmm, in the rtm build of vs2008 i can only get js intellisense working in .js files but not in .htm,.html or .aspx files. There is no error or anything? Is there any way I can figure out why this isn’t working?

  7. robert says:

    oh, and if I press ctrl-shift-j to update intellisense I get "Could not complete the action"

    I’ve tried it with creating a new asp.net website, with everything default and i got the same results.. 🙁

  8. Sameer says:

    Hi Robert,

    Thanks for trying out the feature.  Can you share the HTML file you are using?  I will be able to help you out better.

    My email is: sameerch @ microsoft.com

    Thanks

  9. Gleb says:

    I have the exactly same issue like Robert has. I use final VS Pro 2008. Weird.

  10. Stan says:

    Nice post! Came here via a search in Google on ‘Could not complete the action’. I have the same issues like Robert en Gleb have. Something strange , in the beginning – right after the installation of VS 2008 RTM – it was working…

  11. Thomas says:

    Okay this is a pretty old thread – I know. But I can´t find a solution to the problem I have. Intellisense is working for *.aspx pages but not for *.html pages in my project. Anyone?