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,
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 ?



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.



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


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


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 ?




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?




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 :


or like the PhoneGap Docs :

sorry for my very poor English writen


> 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.



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.


ok , i'll do that :)

thank's a lot Kirill



Please sign in to leave a comment.