IndexedDB Code Completion and Type Hinting

Posted by filed under Goodies to go, How to.

IndexedDB isn’t really a new API, but most (maybe even all) Editors don’t provide code completion for it. This is a little annoying, but there’s a quick fix available: You just need to port the relevant IDL definitions to JavaScript, and tell your IDE to include the resulting .js file as a library. I already did part one for you (you can download the result from GitHub), and this tutorial shoes how to add the IndexDB API to the popular WebStorm / PHPStorm IDEs. I assume that it will work pretty similar for other IDEs.

Step 1: Getting the definitions

The definitions are available from this repository: You can clone or download the repository, or just download the IndexedDB.js file.

Step 2: Telling your IDE to use it as a library

This will work different among IDEs, but will probably pretty similar and straightforward. This is how it works for WebStorm and PHPStorm:

First, open the preferences panel and select “JavaScript” and then “Libraries” from the left section of the window:



There, click the “Add…” button which will open the following window:


Type “IndexedDB” as name and select “Global” as visibility. Next, click on the “Attach…” button to open up a file dialog:


Navigate to the IndexedDB.js file, select it and click “OK”. The Library window now should look like this:


Click “Apply” or “OK” and your done.

Step 3: Fun and Profit

Now you will have code completion, parameter info and argument type hinting, return type hinting and wrong type assignment checks.


[Comments are automatically closed after 30 days.]

Comment via Google+