Knowledge Base

How to Get Auto-Complete Functionality in WebStorm

While some will probably consider this overkill, having access to all the features of an IDE for even small Google Apps projects makes development much easier. Being familiar with JetBrain’s family of IDEs, and having a need to make Google Apps Scripts development easier, I found a simple way to get auto-complete functionality within WebStorm.

First, download DefinitelyTyped and extract the “google-apps-script” directory. There are other ways of installing this package of “typings” but for this example, we will be setting up a project manually. Next, in WebStorm create a project and drop the “google-apps-script” directory inside. At this point your directory structure should look like this:

Google App Script

Now, move the “tsconfig.json” file to the root of your project and update its content so that the “files” attribute has the correct relative paths to “index.d.ts” and “google-apps-script-test.ts”. For this example, the contents should look like:

{
 "compilerOptions": {
 "module": "commonjs",
 "lib": [
 "es6"
 ],
 "noImplicitAny": true,
 "noImplicitThis": true,
 "strictNullChecks": false,
 "baseUrl": "../",
 "typeRoots": [
 "../"
 ],
 "types": [],
 "noEmit": true,
 "forceConsistentCasingInFileNames": true
 },
 "files": [
 "google-apps-script/index.d.ts",
 "google-apps-script/google-apps-script-tests.ts"
 ]
}

Assuming you are using a compatible version of WebStorm (as of writing this I am using 2016.3.3), you should now have basic auto-complete for the Google Apps Script services. Happy scripting!

Google App Script

Reader Interactions

Comments

  1. Troy says

    It’s easier than this in 2017.3
    Settings -> Languages & Frameworks -> Javascript -> Libraries.
    You can just tick libraries and if it isn’t there, click download… and find google-apps-script

Leave a Reply

Your email address will not be published. Required fields are marked *