AngularJS intellisense not working on Visual Studio 2015
As @Balthasar pointed out (and in case you are using Resharper) you will need to enable intellisense from Visual Studio for it to work:
Resharper -> options -> environment -> intellisense -> general, select 'Custom Intellisense' and for Javascript you can select Visual studio. Alternatively you can use the 'Visual Studio' statement completion (second option)
This was not working for me in Visual Studio 2015 RTM in a web project, but I solved the problem.
This project was not created with Visual Studio and does not have a _references.js
file anywhere. So I think this will work in any situation.
I removed all other intellisense resources from within the VS UI to make sure what I did was what fixed it.
- Go to https://www.angularjs.org and pull up the download dialog box.
- Copy the Uncompressed CDN url. Today that happens to be https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.js
- In Visual Studio 2015 RTM, go to
Tools, Options, Text Editor, Javascript, Intellisense, References
. Choose the appropriate Reference Group; for most web project this isImplicit (Web)
. Paste the url at the bottom text box and click the Add button. Don't dismiss the dialog box yet. - Under
Text Editor, Javascript, Intellisense, General
, make sure the check box is checked forDownload remote references
. - Click the OK button.
- (optional) If you want intellisense for the angular providers that you create (not part of the angular framework), add
_references.js
to the root of your project. Don't bother making aScripts
folder. Right click on it and choose auto-sync, then choose update. Go into it and remove any js files created by a build process. If you don't, they can be so large they will break intellisense. Be prepared for a ~5-10 second delay the first time you use intellisense, as it has to load all these references from your project. - You may need to disable intellisense in Resharper for javascript if it interferes with the native intellisense.
- Restart Visual Studio. It will not work until you do this. Also, I'm paranoid about closing all other instances other than this instance first, so these settings "stick". So I suggest you do that before restarting this instance.