angularjs-eclipse
angularjs-eclipse copied to clipboard
Cannot get Angular Explorer to work properly for modules
Hi,
I just installed the AngularJS 1.0.0 plugin on eclipse and created a skeleton AngularJS project using John Papa's hottowel generator (https://github.com/johnpapa/generator-hottowel).
Once the project is created. I'm having many issues with it and the eclipse angularJS plugin. The main issue is that I cannot get anything to be displayed in the Angular Explorer view's modules section. When I refresh the angular modules in the explorer view, and then try to expand the modules folder, I get nothing and the following error pops up in the console (when I trace Tern on console.
getTasks(argNodes[0].sourceFile.name)[name] = {"node": argNodes[0]};
TypeError: Cannot set property 'help' of null
at C:\Program Files\eclipse\plugins\ternjs_1.0.0.201508302102\node_modules\tern\node_modules\tern-gulp\gulp.js:22:51
I did try to exclude the files that are causing problems, but as soon as I exclude a file the same or a similar error pops up on another file.
The same errors are reported multiple time when I try to rebuild/validate the project.
Also, I'm not sure if it is related, but when I open the main index.html file and I select the line where the ng-app directive is located, an error pops up with a "cannot find module with name app". "app" being the name of my main angular module, which is defined in file app.module.js that is included in the index.html file as such
...
;;;
Funny thing is that this error does not actually appear in the eclipse problems view after validation
Any ideas?
Thx, /Sebas
@lmcdubo it seems that you try to use angular + gulp (+node) together. I will try it. I think to fix you error, you should remove gulp + node in your Tern / Modules
I'm having many issues with it and the eclipse angularJS plugin.
Please create an issue per problem.
@lmcdubo please share your project. It will help me to reproduce your problem and fix your future other issues.
@lmcdubo I have fixed your problem with gulp in tern.java 1.1.0-SNAPSHOT.
Wow that was quick!
I will try it out and let you know.
As for the project do you still want me to share? Basically I just created a new static web project with eclipse and generated the code using hottowel generator. I did not change the generated code yet. And you are right it uses Gulp and node.
Thx. /S
As for the project do you still want me to share?
Yes I would like that you share it with your github, if you have other issues. I'm not sure my fix with gulp fixes your problem with angular modules. I think it's because you have selected "Node" tern modules (which creates a scope per JavaScript file). So I suppose we cannot use gulp + angular in the same project. I would like to test that.
and generated the code using hottowel generator
I have never done that, and no time to do that, so please share your eclipse project. Thanks!
Hi,
I tried version 1.1 but it seems that there is a problem installing Tern and it doesn`t work. I'm using latest Eclipse Mars for Java EE
I`ve put the project on github (without the bower components and node modules which can be pulled). You can access it using https://github.com/lmcdubo/testApp.git
Let me know if you need anything else.
Thx, /Sebastien
I tried version 1.1 but it seems that there is a problem installing Tern
What is the problem with the update site http://oss.opensagres.fr/angularjs-eclipse/1.1.0-SNAPSHOT/ ?
I`ve put the project on github
Thanks a lot I have tested quickly and it seems that it works ?
Hi,
Sorry for the late reply,
I did install the official Tern + Angular 1.1.0 release (from the eclipse marketplace). It seems that I still have issues:
-
Auto-completion works, but it's kind of hit or miss. Sometimes it works, but most of the time I get the following message in the auto-complete popup: " Calculation completion proposal took too long. Try again in a few seconds..."
-
Angular explorer modules still does not work.
I'm also getting the following errors over and over on the tern console that seems to correlate with the broken functionality:
C:\Program Files\eclipse\plugins\ternjs_1.1.0.201511082254\node_modules\tern-closure\closure.js:292
return node.body.scope.fnType;
^
TypeError: Cannot read property 'fnType' of undefined
at getFnType (C:\Program Files\eclipse\plugins\ternjs_1.1.0.201511082254\node_modules\tern-closure\closure.js:292:27)
at interpretComments (C:\Program Files\eclipse\plugins\ternjs_1.1.0.201511082254\node_modules\tern-closure\closure.js:219:18)
and also
C:\Program Files\eclipse\plugins\ternjs_1.1.0.201511082254\node_modules\tern-closure\closure.js:295
return node.right.body.scope.fnType;
^
TypeError: Cannot read property 'fnType' of undefined
at getFnType (C:\Program Files\eclipse\plugins\ternjs_1.1.0.201511082254\node_modules\tern-closure\closure.js:295:33)
at interpretComments (C:\Program Files\eclipse\plugins\ternjs_1.1.0.201511082254\node_modules\tern-closure\closure.js:219:18)
@lmcdubo please test with the same context that your shared project https://github.com/lmcdubo/testApp.git
It seems that you use "closure" as tern modules and your project https://github.com/google/tern-closure/issues/42 doesn't contains closure in the .tern-project. Try to remove closure.
Your error:
C:\Program Files\eclipse\plugins\ternjs_1.1.0.201511082254\node_modules\tern-closure\closure.js:292
return node.body.scope.fnType;
^
TypeError: Cannot read property 'fnType' of undefined
at getFnType (C:\Program Files\eclipse\plugins\ternjs_1.1.0.201511082254\node_modules\tern-closure\closure.js:292:27)
at interpretComments (C:\Program Files\eclipse\plugins\ternjs_1.1.0.201511082254\node_modules\tern-closure\closure.js:219:18)
tern-closure doesn't work with last version of ternjs, yoru error is the same than https://github.com/google/tern-closure/issues/42
So please remove "closure" modules and retry it.
Hi again,
Yep it seems that it did the trick. Everything seems to work fine now :-)
I did get the following error while browsing, but it does not seem to affect the functionality.
Tern request#type: {"query":{"type":"type","file":"WebContent/src/client/app/admin/admin.controller.js","end":249,"docs":true,"urls":true,"types":true},"files":[{"name":"WebContent/src/client/app/admin/admin.controller.js","text":"(function () {\n 'use strict';\n\n angular\n .module('app.admin')\n .controller('AdminController', AdminController);\n\n AdminController.$inject = ['logger'];\n /* @ngInject */\n function AdminController(logger) {\n var vm = this;\n vm.title = 'Admin';\n\n activate();\n\n function activate() {\n logger.info('Activated Admin View');\n }\n }\n})();\n","type":"full"}]}
Tern error#type with 114ms: tern.TernException: TernError: No type found at the given position. at tern.server.nodejs.NodejsTernHelper.makeRequest(NodejsTernHelper.java:86) at tern.server.nodejs.NodejsTernServer.makeRequest(NodejsTernServer.java:163) at tern.server.nodejs.NodejsTernServer.request(NodejsTernServer.java:127)
Thanks for the support! /S
Yep it seems that it did the trick. Everything seems to work fine now :-)
I hope tern-closure will fix the problem.
tern.TernException: TernError: No type found at the given position.
Yes it's not a problem, the tern server throws this error when it cannot find type, so it's not a bug.
Please note that I'm trying to improve Angular Explorer for 1.2.0 to refresh module,s directives as soon as you are typing (see https://github.com/angelozerr/tern.java/issues/363)
Thanks for the support!
You are welcome.