Skip to content

Instantly share code, notes, and snippets.

@ethan-deng
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethan-deng/ac2b25d832585e995b7f to your computer and use it in GitHub Desktop.
Save ethan-deng/ac2b25d832585e995b7f to your computer and use it in GitHub Desktop.

JavaScript Intellisense (Code Auto Complete) in Visual Studio 2013

How to set up VS2013 to work with NPM + Browserify

After giving WebStorm 9 a try for a few weeks for client side JS development, WebStorm 9 completely stop responding to user interaction or extremely slow after startup. This force us to go back to the good old boring tool VS :-(.

It seems how to set up JavaScript intellisense such as jQuery 2.0 intellisense for VS 2013 is not well documented at MSDN. The new way to set it up has been blogged at The story behind _references.js.

Here are some missing details and considerations about the setup when use it together with NPM + Browserify.

  1. Install jQuery2

  2. Create _references.js file under "Scripts" folder and right click to enable "Auto-Sync JavaScript References". Click "Update JavaScript References", you will have this in the file

/// <autosync enabled="true" />
/// <reference path="jquery-2.1.3.js" />
/// <reference path="main.js" />

BTW, you will notice that you don't need to reference intellisense.js in the file. VS2013 automatically work with this file.

  1. Exclude the node_modules folder from the project.

NPM will install hundreds of JS file under this folder. Including the folder in VS will blow the _references.js file with unnecessary js files.

  1. Exclude the Browserify build target folder from the project. My practice is to use "Scripts" for any work files but use "js" for the final build by Browserify.

It seems there are still room for improvement for VS2013 to work with NPM, CommonJS and Browserify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment