# Thursday, 01 September 2011

Visual Studio is a great tool but not all tooling is well known. I see this question still way too often on the ASP.NET forums so I thought I would blog about it.

Problem:

You have a nice -vsdoc.js file sitting in your solution explorer and are used to get that great Intellisense kicking in when you work inside a webpage or webform doing some cool ASP.NET coding.

scriptsinsolutionexplorer

Figure 1: Solution Explorer showing our –vsdoc.js files

However if you want to follow good habits and make use of best practices and opt for a non obtrusive javascript approach, meaning simply that you put your script in a separate file with .js extension, you find yourself out of luck. Intellisense is gone!

nointellisenseforjavascript

Figure 2: No Intellisense when we expect to see some assistance for jQuery

Yikes!

Solution:

Of course there’s a solution. And luckily for us, a very easy one:

  1. Open the .js file
  2. In the Solution Explorer pick the right –vsdoc.js file
  3. Drag and drop that in the .js file like in figure 3
  4. Now try to type $( again and you’ll see like in figure 4 that Intellisense is back again.
  5. Drink a beer and celebrate (this last step isn’t really necessary but can spice up the fun factor)

dragdropjsfileonjsfile

Figure 3: Drag and drop from the Solution Explorer into the opened .js file

intellisenseisbackforjavascript

Figure 4: Intellisense is way back. Woohoo!

Grz, Kris.

Thursday, 01 September 2011 21:18:55 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, 28 October 2008

I just noticed that on the site of jQuery there’s now also a download available for having a much better intellisense experience. It’s actually a big js file with xml comment that Visual Studio can interpret but it can be used to power up the development experience. Also when you do reference this only do so while developing and don’t put this into production since it’s waaaay bigger than the minified version (or the packed one). So make sure that you set that into production instead.

Update: I just found out about these extra handy tips for adding the documented jQuery file to your pages.

Grz, Kris.

Tuesday, 28 October 2008 08:29:43 (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  |