Javascript – Visual Studio 2008 jQuery IntelliSense sporadically fails, restarting VS fixes

intellisensejavascriptvisual studio

Right off the bat, this is not your standard "I can't get javascript IntelliSense to work in Visual Studio." For the record:

  • I'm using Visual Studio 2008
  • I have installed SP 1
  • I have installed the hotfix for -vsdoc.js documentation files KB958502

I am developing a suite of interrelated jQuery plugins to be packaged as resources in a class library. So within a directory, I have (as an example):

  • jquery-vsdoc.js
  • core.js
  • plug1.js
  • plug2.js

In core.js, I have the following at the top of the file:

/// <reference path="jquery-vsdoc.js" />

Then in each of the plug#.js, I have:

/// <reference path="jquery-vsdoc.js" />
/// <reference path="core.js" />

The IntelliSense works initially, even including the additions from core.js when working in the plugins. However, sometimes the slightest change, even adding and removing a space from the reference XML tags, or pressing Ctrl-Shift-J, results in the dreaded "Error updating JScript IntelliSense: Client-side script IntelliSense information was not generated due to an error in an external script reference." Except it was working with that external script reference just a second ago!

For the jquery-vsdoc.js, I am using Comment Version 1.3.2b (that's what it says in the file) from http://jqueryjs.googlecode.com/files/jquery-1.3.2-vsdoc2.js. I am omitting the version number from the file so that I don't have to change a bunch of references when it's inevitably updated.

So what could be the problem? Restarting Visual Studio is proving to be a horribly inelegant (and time-consuming) workaround.

Best Answer

Have you tried increasing the IntelliSense timeout?

By default, every IntelliSense request is only allowed 15s to execute. This is to prevent IntelliSense from scripts with infinite loops. If you have a large script or slower machine, it may make sense to increase the timeout limit. The timeout value store within following registry keys (depending on if your are using Express or the full product). The value is in milliseconds so choose something greater than 15000.

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\HTML Editor\JsFailsafeTimeout HKEY_CURRENT_USER\Software\Microsoft\VWDExpress\9.0\HTML Editor\JsFailsafeTimeout