[jbosstools-issues] [JBoss JIRA] (JBIDE-15837) Improve the CordovaJS library provider

Denis Golovin (JIRA) issues at jboss.org
Tue Feb 18 05:01:47 EST 2014


    [ https://issues.jboss.org/browse/JBIDE-15837?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12945457#comment-12945457 ] 

Denis Golovin commented on JBIDE-15837:
---------------------------------------

I've been looking into the current implementation of Infer Engine and it looks like we can use it and provide support for cordova-js. Gorkem's branch is right way to do it.

*The problems/questions I see are below:*
1. In video (if i get it correct) it stated that 

{code}define('cordova', function(...) { ... }){code}

defines cordova global variable that should be available in content assist after app.init() call. But it is actually defined in window and thus available on as just cordova in html page. I actually can see it right now in proposal list even without cordova infer engine installed, but it just empty object that should be actually filled.

2. Channel and CordovaNavigator should not be available in content assist because they are not in global or window context. I tested that with browser version (which I built locally) and it fails to resolve both references. They do available trough cordova.require("module/name") call. Does that have ring of truth?

3. Current way to show just module names as part of js file structure is confusing. Was it temporary solution? Should we come up with something that would look closer to actual javascript structure? For me showing something like

define("cordova")
\|-require("module/name1")
\|-require("module/name2")
\|-requre
\|-define
\|-version
\|-platformId
\|-e.t.c

would be a better option (if it is achievable)

4. Cordova infer engine is going to process only cordova.js file, because the way it detects modules would work only for cordova (see below).

5. Would we good to recognize code like
{code}var channel = cordova.require("cordova/channel"){code}
or
{code}var channel = require("cordova/channel"){code}
and then provide content assist for channel variable.
Does that relevant/required?

6. Content assist for require calls could be shown as list of modules defined using define function.
Does that relevant/required?

*The way infer engine could work:*

This cordova infer engine would process only cordova.js file (should it be activated for files that references cordova.js as well(?)) and look for define("module-name, function() {}) calls to identify modules, then inside function() {} it would search for module.exports = variable, then look back for variable definition and try to identify its structure, then save mapping module name <-> variable mapping. It also can recognize scenario from (5) above and infer object structure for required module.
                
> Improve the CordovaJS library provider
> --------------------------------------
>
>                 Key: JBIDE-15837
>                 URL: https://issues.jboss.org/browse/JBIDE-15837
>             Project: Tools (JBoss Tools)
>          Issue Type: Feature Request
>          Components: aerogear-hybrid
>    Affects Versions: 4.1.1.Beta1
>            Reporter: Gorkem Ercan
>            Assignee: Denis Golovin
>
> The default inference engine fails to infer cordova types properly therefore most of them are not available for code assist. 
> JS library provider is not scanning for changes to runtime or the added/removed plugins. It should adjust to those changes. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list