Found that post on Rick Strahl’s web log, over here he describes different situations in which JS Intellisense is and isnt working in new VS 2008. Check it out:
So I’m trying to understand what actually works and what doesn’t with Orcas JavaScript Intellisense. I’ve used Orcas for a bit now and unfortunately I’ve had little luck on getting Intellisense support with my non-MS AJAX libraries. My own libraries don’t work and neither does anything in Prototype, Scriptalicious or jQuery.
It appears that Orcas does fine with any straight function and variable definitions. If I have an ASPX page or a backing .js file and all I have in there is plain functions as is often the case with front end UI code I get Intellisense on this functionality.
The real issue has to do with class/object recognition. The problem there of course is that there are many, many different ways in JavaScript to define a ‘class’ (there really are no classes only closures that act like them ) and Orcas Intellisense only supports some of these formats.
So I set up a a sample JS file that checks for different class formats and how the Intellisense works for them. I created a simple ASPX page and added a reference to a script file. The comments indicate whether the structure is visible to Intellisense.
<script src=”test.js” type=”text/javascript”></script>
And then created the JS file with the following:
// this works finefunction HelloWorld(name){ alert(“Hello “ + name); return false;} // Class as closure - doesn’t workfunction MyClass1(){ this.myProperty = “Test”; this.myProperty2 = 0; this.myMethod = function(input) { return 0; }} // JSON static Class syntax - worksvar MyStaticClass2 ={ myProperty: “Test”, myProperty2: 0, myMethod: function() { return 0; } } // Prototype syntax - worksfunction MyClass3(){}MyClass3.prototype ={ myProperty: “Test”, myProperty2: 2, myMethod: function(num) { // return 0; } } // *** Additional Prototype assignments - worksMyClass3.prototype.myProperty3 = 3; // *** Direct property assignment - doesn’t workMyClass3.myProperty4 = 4;
I might be missing other ways here - if you see one of those leave a comment and I’ll add it here. It seems it would be good to know what does and doesn’t work.
