angularjs-visualstudio-intellisense
angularjs-visualstudio-intellisense copied to clipboard
angularjs intellisense not working in Visual Studio Enterprise 2015
I thought I would just go ahead and open a new issue, as suggested. Thanks!
I have current release version and it still does not work. My script paths are in App_Start\BundleConfig.cs. Could this be why?
I also have "~/Scripts/_references.js" in "Options/JavaScript/Intellisense/References" dialog.
have a repository with the sample project demonstrating the intellisense issue.
Repository name is: VS2015-Angular-Intellisense-Test
Thanks for this, @GregLarden! I forked your repo, made some tweaks to get IntelliSense working in the Admin module, and I've submitted a pull request back to you. Here's what I had to change:
- In _references.js replaced
../../localhost/bower_componentsreferences with../bower_components. The file paths were bad. - Replaced the reference to
../test/app/app.module.jsto../app/app.module.js. Again, bad path. - In your
admin.module.jsfile I needed to references theblocks.loggermodule, otherwise the code in admin.js could not understand the logger factory.
Let me know if that works well enough for you, or if you have other questions! Jordan
@jmatthiesen Thank you very much for the help! This worked! Would you mind explaining this situation below?
So I have a dataservice service that is added to the app.core module and the app.core module is added to the app module where all modules are added.
The interesting part is, I get the yellow explanation mark on the dataservice intellisense unless I add app.core directly into the admin.module. Do you know why that is?
//ALL MODULES ADDED angular.module('app', [
'app.core', 'app.widgets', 'app.admin', 'app.dashboard', 'app.layout' ]);
angular .module('app.core') .factory('dataservice', dataservice);
I believe you have identified a legitimate bug in the Intellisense processor, although I'm not 100% sure how to fix it at the moment. The block that starts on line 476 of angular.intellisense.js is what "tracks" modules. When the "app" module is added, it recursively tracks all of its dependent modules, decorating their provider functions for Intellisense, but at that point the "app.core" module hasn't been defined yet, so I think it might be overwritten.
As a workaround, declare the "app.core" module before the "app" module and see if that works.
i've just realized that the automatic order that _reference.js file uses (first my files then the framework's files) prevented intellinsense to work on other files that weren't the app.js file
Yes script order in _references.js is very important. It's just as important as script order on your HTML pages. AngularJS needs to be present and your modules declared before you start registering providers.