Javascript intellisense in Microsoft Visual Studio 2008 (VS2008)

When I first saw that (VS2008) started to allow for on I was happy! Not many seconds after that my suspicious old mind saw some problems, one of them was the fact that the vast amount of would follow the javascript files making them too big and slow down pages using them.

The intellisense got smarter!

The way that the intellisense got smarter is that VS2008 allows you to have the documentation in a seperate file. That way your main code will not be “heavy” for browsers to use – only at development time will the “-vsdoc” documentation file be used!

VS2008 will search for documentation in 3 predefined files – 3 patterns will be searched for: If you have a library, say "mylibrary.js", VS2008 will search for documentation in the same directory in this order

  1. "mylibrary-vsdoc.js", then if that is not found, a search for…
  2. "mylibrary.debug.js", then if that is not found, a search for…
  3. "mylibrary.js"

So if you program a javascript library you can add VS2008 intellisense code in a version named in one of the two ways shown above (or embedded in the main library), and then save it in the same folder as the actual library. This will introduce help on methodes in the library.

If no intellisence appers as you type try updating: “Edit > IntelliSense > Update Javascript IntelliSence (Ctrl+Shift+J)”.

To get this feature you will need to install this hotfix for VS2008.

You can see a description of how to use the "-vsdoc" part in jQuery here:
Rich IntelliSense for jQuery.

Below you can find links to related posts/articles – one of them “The format for JavaScript doc comments” I thing is very important as it is a guide to how you add documentation (and intellisence) to your own javascript code. So now there are more than one argument to start documenting your code!

Happy documenting!

/Sten

Related articles

US

Leave a Reply