[jbosstools-dev] AngularJS Eclipse

Max Rydahl Andersen manderse at redhat.com
Wed Feb 26 11:05:04 EST 2014


> Hi JBoss guys,

Hey Angelo!

> I'm the creator of AngularJS Eclipse and Mickael Istria suggested me 
> to
> contact you.

Yes :)

> I have seen that you have spoken about AngluarJS Eclipse at
> http://lists.jboss.org/pipermail/jbosstools-dev/2013-December/008450.html

> At first, I would like to apologize because Max pinged me on tweeter 
> and I
> have not seen that-( Sorry!

no worries - you are here now ;)

> I would like to answer about some comments :
>
>> It provides ng-* completion which we do too. And IMO ours is better
>> since we provide context-dependent code completion.
>> For example we suggest count/when/... attributes only for 
>> ng-pluralize
>> directives (<ANY ng-pluralize> or <ng-pluralize>)
>> Or ng-maxlength only for input directives. Or we don't suggest ng-app 
>> if
>> it's already defined in any parent tag. Etc. So we analyze the 
>> context
>> when calculating what can be suggested in the particular place.
>
> Except for "ng-app if  it's already defined in any parent tag", 
> AngularJS
> Eclipse manages that :
> See screenshots at
> https://github.com/angelozerr/angularjs-eclipse/wiki/HTML-Directives
>
> More it works too with custom directive : see screenshots at
> https://github.com/angelozerr/angularjs-eclipse/wiki/HTML-Directives#wiki-custom-directive
>
>> It does not provide code completion for {{}} expressions which we 
>> plan to
> do in JBT 4.2.
> Today it supports it. See screenshots at
> https://github.com/angelozerr/angularjs-eclipse/wiki/HTML-Features#wiki-angular-expression-management

and it does that without *running* the project javascript ? that is pure 
tern parsed ?

if yes - that is nice!

I thought there were things in angularjs context that would not be 
possible to extract from javascript?

Saying this in context of our experiment where we actually ask the 
browser what is in the angular scope
at runtime....but maybe these two approaches could simply be merged and 
we get best of both worlds?

>> The upstream project
>> https://github.com/angelozerr/tern.java/wiki/Tern-Eclipse-IDE is
>> supposed to provide some angular specific code completion in *.js 
>> files
>> but I couldn't manage to make it work.
> It seems that it's a problem with node.js Please
> read 
> https://github.com/angelozerr/tern.java/wiki/Tern-Eclipse-IDE-Node.js<https://github.com/angelozerr/tern.java/wiki/Tern-Eclipse-IDE-Node.js>

I tried installing OSX osgi bundle provided node.js and it seems to NPE 
for me ;/

I thought I actually saw this working but that might have been earlier 
version.

I think the default should be that out of box Tern/angularjs integration 
should use the bundled one and
then advanced users can decide use native one...optimally default users 
should not have to care about
it is using node.

> Completion is done for angular model (angular.module, etc) but too 
> with the
> injection of controller scope and directive (should be improved 
> again). See
> screenshots
> at 
> https://github.com/angelozerr/angularjs-eclipse/wiki/Javascript-Features<https://github.com/angelozerr/angularjs-eclipse/wiki/Javascript-Features>
>
> AngularJS Eclipse extends the WTP HTML Editor (I don't have created a 
> new
> HTML editor).

Yeah, what I would like to enable is that we don't need 
"yet-another-editor" but could just
have this enable in jboss tools existing html editor (or even JSDT html 
editor but thats far off yet ;)

> I would like tell you about pros and cons for using tern :
>
> The cons for using tern  :
>
> * needs node.js
> * written in Javascript, so it's difficult to debug it with Eclipse. 
> But
> tern works in the browser, so I use Chrome to develop the angular 
> plugin.
>
> The pros for using tern  :
>
> * very powerful. It manages complex case. See demo at
> http://ternjs.net/doc/demo.html
> * tern provides plugin/defintions for ecma5, jquery, node, angular.
> * tern is very extensible, so you can create your own tern
> definition/plugin like I have done with AngularJS. I use tern in HTML
> Editor (see
> https://github.com/angelozerr/angularjs-eclipse/wiki/HTML-Features) 
> and
> Javascript Editor (
> https://github.com/angelozerr/angularjs-eclipse/wiki/Javascript-Features).
> * tern can be executed in a browser. This feature can be very 
> interesting
> in some case. For instance I'm developping a tern plugin to manage 
> AlloYUi
> a javascript framework used by Liferay (see online demo with 
> CodeMirror at
> http://codemirror-java.opensagres.eu.cloudbees.net/codemirror-javascript/demo/alloyui.html).
> My idea is that you could use this AlloYUi plugin inside Eclipse IDE 
> and
> inside the Liferay Portal.
> * as tern is written in Javascript, the community is very big.

Yeah, you basically outline the same exact reasons why I think trying to 
use Tern as a
backend for JSDT is a bit weird, but more sustainable/maintainable than 
writing/extending
the java based parser.

It just needs some enduser polish (i.e. users should not need to care 
about different html editors,
different node.js runtimes, it should "just work").

> Hope my information will be useful for you.

Yes definitely.

One concern we had was performance and portability.
Does Tern handle larger projects of javascript well ? Can we avoid it 
have to parse
constantly ? can one just tell it to parse one file as oppose to all 
files all the time ?

Have you found the bundled binaries to work across various OS's ?



/max
http://about.me/maxandersen



More information about the jbosstools-dev mailing list