jmbledsoe / angularjs-visualstudio-intellisense

Visual Studio extension providing statement completion for injected AngularJS components in JavaScript files.
MIT License
110 stars 22 forks source link

Incorrect IntelliSense when two services are created with the same name, but in separate modules #9

Closed jmatthiesen closed 9 years ago

jmatthiesen commented 9 years ago

Looking through the code I realized that it's not paying attention to the actual modules referenced, and instead tracks all dependencies independent of module/globally. This results in accuracy issues like the following, where you see functions from MyService in module2, but expect to see the functions from MyService in module1:

angular.module('module1', [])
.service("MyService", function () {
    return {
        fnFromMyService1: function () { }
    }
});

angular.module('module2', [])
.service("MyService", function () {
    return {
        fnFromMyService2: function () { }
    }
});

angular.module("app", ['module1'])
.run(['MyService', function (service) {
    // ERROR: IntelliSense for service. should show fnFromMyService1, but it shows fnFromMyService2
}]);
jmbledsoe commented 9 years ago

This has been fixed with the most recent update. 1c3a0a3187a2563fecf6398d1554006a2536ff3f

jmatthiesen commented 9 years ago

Drat - The snippet above still fails for me with this latest update, I'm seeing fnFromMyService2 instead of fnFromMyService1.

jmbledsoe commented 9 years ago

You are right. For some reason (just a slip of the mind) I thought that was expected behavior. Working on this too late I suppose.

You are correct in your assertion that the _intellisense.js file isn't actually keeping track of module dependencies. It should be possible, but I'll need to investigate further to determine how.

On Fri, Oct 24, 2014 at 2:01 AM, Jordan Matthiesen <notifications@github.com

wrote:

Drat - The snippet above still fails for me with this latest update, I'm seeing fnFromMyService2 instead of fnFromMyService1.

— Reply to this email directly or view it on GitHub https://github.com/jmbledsoe/angularjs-visualstudio-intellisense/issues/9#issuecomment-60347923 .

jmbledsoe commented 9 years ago

(Really) fixed in 9211f81f39321554b87a8cb8e1de744806e20249.