January 31st, 2008

JScript IntelliSense: Handling Errors

I often get the question “Why isn’t IntelliSense working?”.  The most common cause is an error in one of the referenced scripts.  If there was an IntelliSense update error, the status bar will tell you.

Given this situation, the Error List  will complement the status bar with one of two messages.

Error Message 1: A script failed to execute…

This type of error is commonly caused by either a syntax error, calling a member that doesn’t exist, or an infinite loop.  The filename/source is provided to help you debug.  After the script error is fixed, IntelliSense will automatically retry.  Note: I’ve noticed the line number to be off by 1; we’ll be fixing that.

Error Message 2: Something more serious…

In rare occurrences, our execution/analysis engine (TypeLibBuilder.exe) will crash due to the script input.  A stack overflow is the only known cause for this.  Rather than retrying the script in question, we will disable IntelliSense temporarily until you reopen the file.

Known JScript IntelliSense Limitations

While script errors may cause incomplete IntelliSense data, the following feature limitations may also be the root case:

  • Invoking browser-specific objects is not recommended – Each browser provides a specific object model you can program against.  We recommend that your library scripts are refrain from execution dependencies against these objects.  Such invocations will lead to member-not-found errors while being analyzed by our execution/analysis engine, which will affect IntelliSense.  Note it’s okay to have references to the object model (such as inside a function) as long it is not invoked at design-time.  Note: It is a known issue that certain 3rd party frameworks are affected by this limitation and we are currently working to make accommodations there.
  • Referencing files outside of the project is not supported – IntelliSense will only be aware of references to files that are within your project scope.  Referencing files in another domain or another virtual directory is known to fail.  We are working to relax this constraint in the next major update.
  • XML Doc Comments IntelliSense for the active document is not supported – Due to an architectural limitation, you will not be able to see any XML Doc Comment info defined in the file you are currently in.  Only XML Doc Comment data from referenced files will be visible.

If All Else Fails…

JScript IntelliSense was designed to continuously monitor changes and update IntelliSense accordingly.  If for some reason it does not update, we’ve added a command to force the mechanism to recalculate its data.  You can find this command under “Edit”, “IntelliSense”, “Update JScript IntelliSense”.
 

As a final note: “An escalator can never break, it can only become stairs.”  Likewise, in the event of an advanced IntelliSense failure, there should always be basic IntelliSense available for JScript intrinsic objects and their members.  In tangible terms, if you type “Object” dot, the completion list should always contain “prototype” regardless of any script failures.  In the unlikely event there is no IntelliSense at all, please feel free to let me know personally at jking-at-microsoft-dot-com.

Hope this helps!

Jeff King
Program Manager
Visual Studio Web Tools

0 comments

Discussion are closed.