Special Javascript libs (localFileSytem, Phonegap API ...)

hello All

I'm  working on a PhoneGap project, the installation, debugging on emulator & USB  device work's nice.

As I'm in Phonegap environement, I use spécial javascript libs, but I'm don't know how to configure Intellij to add those libs/javasctip files  (various type of Object & Classe) and make it available for my project, for example  :

File Systeme api :

LocalFileSystem.PERSISTENT static variable, BlobBuilder class etc ... 

PhoneGap : Camera,
Camera.PictureSourceType.CAMERA  
etc ....


in my project params i've check that Javascript>Librairies>HTML5 is here.... but Intellij notice "undefine" some of the Class I've listed below.

Do I missing some project setting ? (i've tried a blank HML5 project to see if changes, but there is not code completion to)
Or the fact that i'm in a "hybrid project" makes intellij difficult to parse additional Javascript libs ?

Larry
7 comments

Hi,

As I see you have troubles with completion of PhoneGap API. Built-in HTML5 library won't help in this case. You need to download source JavaScript files for PhoneGap library, create a *new* library and add the files there. Please get back to me if it does not work.

Kirill

0

Hi Kirill

Well, i've got troubles with PhoneGap but with some recent libs to, like FileSystem API only available with the last release of Google Chrome.

For example I'm trying to code this, but there also no Class recognize by IDEA

I've re-try to add "new library" to be clear I've done some screenshots :



this the global wiew of my app project, let's say that for the moment i only whant to use PhonegapCordova libs

intellij_question_0.JPG


































i can not add javascript libs directly to the project module  (Java & Maven only)  but only in the Global Libraries:
intellij_question_2.JPG


intellij_question_1.JPG



is this the good way to add library, because a lot of class seems to not be available  ? ...


And, generaly, how to use FileSystem API (or new libs that haven't got js file with ) code enable and autocomplete ready available in my project ?

Hope my question is clear ?

larry

0

Hi,

You can add JavaScript library to the module in IntelliJ IDEA via Settings -> JavaScript -> Libraries (the same way as in WebStorm). Difference from WebStorm is that you can the contents of the library via Project Structure dialog. Can you please try this and get back to me then?

Thanks,
Kirill

0

Kirill

yes, i've done it right, finaly, for the Cordava Class, I have missing the fact I must use (?) the namespace "cordova" ant then I've got some static variable that I haven't before.

I thing as the code example on the PhoneGap Api Doc don't use namespace make me on error

from Official doc :

Camera.sourceType = Camera.PictureSourceType.CAMERA


What I must do:
cordova.CAMERA.sourceType = cordova.CAMERA.PictureSourceType.CAMERA

so thank you for your help :)

but there is one thing that I don't understand  is how to have the IDE enable to read and complete the lastest libs only available on Google Chrome like, for example, the systmeFile API ?
well, I suppose that there is not special file.js for thoses new libs. Unfortunately no of all the Class is available on Intellij for example :

window.PERSISTENT


or like the PhoneGap Docs :
LocalFileSystem.PERSISTENT


sorry for my very poor English writen

Larry
0

> but there is one thing that I don't understand  is how to have the IDE enable to read and complete the lastest libs only available on Google Chrome like

If you want to use the methods or properties that are not the part of official specification (and thus are not bundled with WebStorm) you need to find definition files (aka stubs) somewhere (do a google search, ask in mailing list or create yourself), download and create new library for them. Done that, IDE will provide you completion and syntax hinting for such symbols.

Kirill

0

What for completion problems, please watch or vote for http://youtrack.jetbrains.com/issue/WEB-2355 (you can login via Open ID). We plan to provide better completion usability in the next version of WebStorm.

0

ok , i'll do that :)

thank's a lot Kirill

larry

0

Please sign in to leave a comment.