Skip to content
jrburke edited this page Aug 20, 2012 · 4 revisions

Notes on how to set up a project to use require.intellisense, and how to do debugging of changes to require.intellisense.js.

General info on intellisense: http://msdn.microsoft.com/en-us/library/hh874692%28v=vs.110%29.aspx

Project setup

In the data-main JS file, or the main JS file loaded, will need to add this to the top:

/// <reference path="require.js" />

This is most easily done by opening the main JS file, then dragging the require.js file from Solution Explorer into the opened main.js file, and Visual Studio will create the reference for you with the correct path.

This will ensure the intellisense machinery will run require.js first before running this file, and will enable the autocompletion to work.

Debugging require.intellisense.js

  • Open the Output pane via the menu item: View, Output
  • In require.intellisense.js, use intellisense.logMessage(String). Make sure you are logging a string value only, other values will cause an error.

Other useful intellisense methods

intellisense.redirectDefinition()

Sets up F12 Jump to Definition to be original source file location instead of the method in require.intellisense.js

intellisense.annotate()

Sets up docs that are shown in autocomplete. Useful because it allows setting up multiple call signatures.