My primary goal is to get VSCode intellisense to work with AngularJs.
To get intellisense working for AngularJS in VSCode. The following steps need to occur
- Install node.js typings package globally
- Run typings and install AngularJS types
- Create a jsconfig.json file
Assumptions of reader
- Have knowledge of node.js and npm
Tools and version
- node.js 6.2.1
- npm 3.9.5
- Visual Studio Code 1.2
1. The Situation
In module.js, when I enter “angular.” I expect that intellisense to display a list of AngularJS methods and properties, but as you can see in the image below, this does not occur. My goal in this blog post is to have intellisense display AngularJS methods and properties.
2. Install typings package
The typings package needs to be installed. Since this package will be used for this solution and others. I want to install it globally. First lets’ see what packages are installed currently on the computer.
To figure out what packages are installed globally, run the following command.
npm list -g –depth=0
This command will return all packages at a root depth and not include any children or dependencies of the base packages.
As we can see the typings package has not been install. Let’s install it globally.
npm install -g typings
Now that we installed typings it should now be available to use. Notice the version of typing is 1.3.0.
3. Install AngularJS types
When I initially attempted to install angular typings, I received the following error (see image). This worked just a few days ago. But I install typings 1.3.0. and my typing install didn’t use the same format as pre typings 1.0 used. You can read more about that here Updating Typings From
To install angular typings, I had to enter the following command:
typings install dt~angular –save –global
When the angular typing is installed the typings.json file and a folder called typings should be created. See image below for more information .
4. Create a jsconfig.json file
Now create an empty jsconfig.json file.
If we were using TypeScript and transpiling code, then this file would contain configuration. But since we are only need intellisense to work, this file can remain empty
5. Validate if Intellisense is working for Angular
Go back to the module.js file. Enter “angular.”. The intellisense should now display AngularJS methods and properties.
- Updating Typings From 0.x to 1.0?
- StackOverflow – typings.json not getting updated typings install –ambient
- Github Typings
- Visual Studio Code – Visual Studio Code Loves ES6
- StackOverflow – Visual Studio Code and jsconfig.json