Giter VIP home page Giter VIP logo

Comments (10)

angelozerr avatar angelozerr commented on May 30, 2024

Hi Jose,

Thank's for your encouragement.

Today scripts path works only for folder/files which are hosted inside an Eclipse project. I don't know if it's easy to implement script paths outside the given project. I must study that to see if it's possible to implement it.

Regards Angelo

from angularjs-eclipse.

josebalius avatar josebalius commented on May 30, 2024

@angelozerr So for now i made a copy of the js folder in common and im including it in my main project.

Now I have another problem, my directory structure looks like the following:

js
   application
        ExampleController.js
        component
            ComponentController.js
   common
        services
             ApiService.js

If I inject and use ApiService from ExampleController.js, i get the expected completions, but if I do it from ComponentController, i get 0 suggestions, have you seen this before?

Thanks again

Jose

from angularjs-eclipse.

josebalius avatar josebalius commented on May 30, 2024

@angelozerr Just ran some more tests, and it seems to be because ComponentController.js is defined as angular.module("app.component") and ApiService is defined as angular.module("app"), so I guess you only get suggestions if the service belongs to that module.

Is there anyway to always get the suggestions?

from angularjs-eclipse.

angelozerr avatar angelozerr commented on May 30, 2024

Jose, it's very hard for me to understand your problem.

I suggest you that you create a simply project in your github which causes the problem. I could see in action your problem.

And please create a new issue if it's not the same problem than this issue.

Thank's

from angularjs-eclipse.

josebalius avatar josebalius commented on May 30, 2024

@angelozerr Here: https://github.com/josebalius/angularjsternmoduleexample

If you try to get suggestions for ApiService when using it in "SecondController" it doesn't work, but if you do it in "FirstController" it works because it belongs to the same module as the service, however as you can see in app.js, ApiService is also available to SecondController thus it should provide suggestions.

Let me know if it makes sense now, i threw this together very quickly before I left work.

Jose

from angularjs-eclipse.

angelozerr avatar angelozerr commented on May 30, 2024

I have tried your sample. You have :

angular.module("app.extra", []);
angular.module("app", ['app.extra']);

angular.module("app").service("ApiService", function() {
    this.makeCall = function() {
        return "You made a call";
    };
});
angular.module("app").controller("FirstController", function($scope, ApiService) {
    ApiService. // here Cttl+Space works
});

angular.module("app.extra").controller("SecondController", function($scope, ApiService) {
    ApiService. // here Cttl+Space doesn't work
});

But are you sure that module dependencies are correct? If I write :

angular.module("app", []);
angular.module("app.extra", ['app']);

It works.

from angularjs-eclipse.

josebalius avatar josebalius commented on May 30, 2024

Hmm, I am not sure if mine or yours are correct. The way I originally wrote it still works with Angular (you can still use ApiService), and the way our app works is we bootstrap the main "app" module, which will have the different sub dependencies.

Like

angular.module('app.services', []);
angular.module('app.directives', []);
angular.module('app.controllers', []);
angular.module('app', ['app.services', 'app.directives', 'app.controllers'])

app.services, app.directives, and app.controllers all have access to anything defined under app.

If you look at the app.js example for the MEAN stack, you will see the same thing:

https://github.com/linnovate/mean/blob/master/public/js/app.js

This is an interesting problem for sure. Do we know which part of the plugin is making the decision whether to show suggestions or not based on the module name?

from angularjs-eclipse.

angelozerr avatar angelozerr commented on May 30, 2024

Do we know which part of the plugin is making the decision whether to show suggestions or not based on the module name?

You can find the tern plugin at https://github.com/angelozerr/tern.java/blob/master/core/tern.server.nodejs/node_modules/tern/plugin/angular.js This plugin is a fork of the original of tern project and, so it's difficult for me to tell you where you can change that. This plugin manage injection in the applyWithInjection

I will study this problem when I will have time.

from angularjs-eclipse.

angelozerr avatar angelozerr commented on May 30, 2024

Hi Jose, please reinstall AngularJS Eclipse. You will benefir with "Add Project" button in tern script path preferences. Please read https://github.com/angelozerr/tern.java/wiki/Tern-Script-Path#project---tern-script-path for more info.

I close this issue which is related to "external" project. If you have other problems, please create an other issue.

from angularjs-eclipse.

josebalius avatar josebalius commented on May 30, 2024

Wow, thank you @angelozerr I will be using this now :)

However for anything else that has an issue with the way their dependencies are declared, i created an extra JS file for Tern to load and simply did this:

var _oldModule = angular.module;
angular.module = function(name) {
    return _oldModule('app');
};

So, all modules like angular.module("app.extra"), etc now get the suggestions from the 'app' module services. Read above if you want to see the history of the problem.

from angularjs-eclipse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.