JavaScript intellisense in Visual Studio 2008

javascriptvisual-studio-2008

Have you guys and gals got any tips or hacks for making the most out of the JavaScript intellisense options in Visual Studio 2008?

Visual Studio shows me the "namespaces" and uses the documentation features (<param> and <summary>). I have not been able to get the <return> documentation feature to work though.

Now, that's all well and good. But when I call a privileged function, Visual Studio does not know about it, and thus I get no documentation.

Is there any way I can expose public variables and privileged functions to Visual Studios intellisense functionality, while still creating objects with private members?

Best Answer

Javascript Intellisense is definitely flaky as far as recognizing function members. I've had slightly more success using the prototype paradigm, so that's something you could check out. Often times, though, I find it still won't reliably list functions in the Intellisense.
Edit: As the original poster suggested in the comments below, it's not really possible to get the same "private" functionality in the prototype model. Javascript doesn't have a concept of private members, but you can emulate member privacy with closure by declaring them in the function constructor. The means though that if you have functions that need to access members, they have to be in the constructor too, so they can't be prototypes.
So while using the prototype model may (or may not) give you better VS Intellisense, it's only useful for public functions that hit public members, and can't be used to improve intellisense for private or privileged functions. Private functions you probably don't want intellisense anyway, but privileged you likely would.