angelozerr / tern.java

Use tern.js in Java context
http://ternjs.net/
Other
249 stars 52 forks source link

Update ExtJS module to the latest definitions #436

Closed kaloyan-raev closed 8 years ago

kaloyan-raev commented 8 years ago

I've just tried working on an ExtJS 4.2.1 project with the latest Tern 1.3.0-SNAPSHOT.

I noticed that some code assist results are incomplete - missing parameter types and result types for some functions like Ext.urlAppend().

I found that the code assist info comes from the /node_modules/tern/plugin/extjs4.2.1.js. It contains a huge JSON object with the API info. The methods with incomplete info contains just "?". It looks like the generator of this file could not collect all the info from the API documentation.

Then I found another project: https://github.com/angelozerr/tern.jsduck. It contains an updated version of the extjs4.2.1.js file: https://github.com/angelozerr/tern.jsduck/commits/master/plugin/extjs_4.2.1.js

I tried copying this file over the existing one in the ternjs plugin, but then the code assist for ExtJS simply stopped working - I get no ExtJS results.

What is the proper way for updating the ExtJS module to the latest definitions from the tern.jsduck project?

angelozerr commented 8 years ago

Indeed @fflorent has improved a lot ExtJS support. I have not found time to integrate her work.

I have tried quickly and I have the same problem than you @kaloyan-raev To fix the problem:

I have no time to study this problem. @fflorent if you have time, could you study the problem, thanks!

Sencha provides their own Eclipse plugin for ExtJS. Do you know if tern extjs support is really helpful?

kaloyan-raev commented 8 years ago

Thanks @angelozerr! Your instructions helped to make code assist working again. How did you spot that this part of the definition is the problem?

BTW, changing Ext.util.Observable[]... to [+Ext.util.Observable] also resolves the issue.

I think that the ellipses (...) are causing the problem. The generator fails to break Ext.util.Observable[]... from the JSDoc into two separate tokens: Ext.util.Observable[] and .... Then Ext.util.Observable[] should be converted to [+Ext.util.Observable] and I am not sure what should happen with ....

/cc @fflorent

angelozerr commented 8 years ago

Your instructions helped to make code assist working again

You are welcome @kaloyan-raev !

How did you spot that this part of the definition is the problem?

I have enable Tern Console to see this error in the Eclipse console (Tern / Development and check "tern console")

The generator fails...

Thank's @kaloyan-raev for your feedack. Is there any chance that you could contribute to tern.jsduck (I know you are very busy)?

@fflorent have you time to fix this issue? Once this issue will be fixed, I will integrate the work of @fflorent inside tern.java and I will do screenshot with new cool features.

@kaloyan-raev Sencha provides their own Eclipse plugin for ExtJS. Do you know if tern extjs support is really helpful?

kaloyan-raev commented 8 years ago

I have enable Tern Console to see this error in the Eclipse console (Tern / Development and check "tern console")

This is really helpful!

Thank's @kaloyan-raev for your feedack. Is there any chance that you could contribute to tern.jsduck (I know you are very busy)?

Yes, I can if I understand quickly how the tern.jsduck generator works.

BTW, I am not really sure what is the semantics of the ellipses ... and how should they be represented in that JSON definition. Could you give me some explanation?

@kaloyan-raev Sencha provides their own Eclipse plugin for ExtJS. Do you know if tern extjs support is really helpful?

For users who have a commercial license, I guess the plugin by Sencha is the better choice. The ExtJS support in Tern would be helpful for those who use ExtJS under the GPL license.

However, I am not really familiar with ExtJS. I am just exploring the Tern capabilities as I am integrating JSDT 2.0 and Tern in the next version of Zend Studio.

angelozerr commented 8 years ago

This is really helpful!

Glad this feature please you:) Please note that you can debug too tern plugins with breakpoint. See https://github.com/angelozerr/tern.java/wiki/Debugging-Tern.js-on-Node.js (in 1.3.0 I have implemented quickly tern debugger with JSDT 2, but I don't know if it works very well).

Yes, I can if I understand quickly how the tern.jsduck generator works.

Cool, see https://github.com/angelozerr/tern.jsduck#how-it-works and https://github.com/angelozerr/tern.jsduck/blob/master/generator/JSDuckApi2TernDef.js If you wish to debug with Chrome, open the html page https://github.com/angelozerr/tern.jsduck/blob/master/generator/ExtJSApi2TernDef_5.0.0.html

For users who have a commercial license, I guess the plugin by Sencha is the better choice. The ExtJS support in Tern would be helpful for those who use ExtJS under the GPL license.

Ok thanks for your feedback.

However, I am not really familiar with ExtJS. I am just exploring the Tern capabilities as I am integrating JSDT 2.0 and Tern in the next version of Zend Studio.

Very cool! Please note I'm working on https://github.com/angelozerr/typescript.java/wiki/Getting-Started which is for TypeScript but too for JavaScript only. It consumes tsserver (it's a ternjs server but for TypeScript which is able to support too JavaScritpt only).

If you are interested, please tell me.

fflorent commented 8 years ago

Sorry, I am a bit busy this week. May I take a look at this this week-end ?

Florent

kaloyan-raev commented 8 years ago

@fflorent Absolutely! There is nothing urgent on this. Thanks for your help!

fflorent commented 8 years ago

PR submitted : https://github.com/angelozerr/tern.jsduck/pull/12

angelozerr commented 8 years ago

There is again a bug https://github.com/angelozerr/tern.jsduck/pull/12#issuecomment-239825062

@fflorent sorry -(

fflorent commented 8 years ago

@angelozerr Fixed as mentioned in the PR :)

angelozerr commented 8 years ago

It works like a charm! Thanks a lot @fflorent !