Skip to content

WebStorm code completion

August 27, 2014

In earlier releases of the ArcGIS API for JavaScript, code completion help was provided in the form of a plug-in called Code Assist.  While this was helpful at the time, a major shift in syntax at the 3.4 release caused coding patterns to change in terms of how modules were loaded using AMD, and unfortunately the Code Assist plug-ins don’t provide support for this newer syntax.

Enter WebStorm to the rescue, which gives developers the ability to load a JavaScript library locally to support code assistance and code completion.

Below is the general documentation link for configuring a JavaScript library to use in WebStorm:

http://www.jetbrains.com/webstorm/webhelp/configuring-javascript-libraries.html

As luck would have it, a timely blog posting covers this process here.

The general steps to utilize the ArcGIS API for JavaScript library in WebStorm are:

1. Import a web application into WebStorm.

2. Download the ArcGIS API for JavaScript into a local folder from the download page.

3. Extract the API on disk into a folder (This task takes a few minutes).

4. In WebStorm, choose  File > Default Settings > JavaScript > Libraries  > Add.

5. Create a name for the Library and change the visibility to Global.

newLib1

6. Use the green  +   and choose Attach Directories.

AttachDir2

7. When configuring the library location path, select the js folder under the 3.9 API folder and choose Apply

The full Library path is: : \arcgis_js_v39_api\arcgis_js_api\library\3.9\3.9\js.

     Note:  Indexing the library takes a moment.

You should end up with a new library that can be used for any project:

Lib_3

Once you have configured an External Library, it will show up in the Project View as seen below:

ProjView_Lib5

 

You should now be able to type class names that belong to this library in the code editor, and work with standard completion shortcuts such as Ctrl + Space.

For general auto-completion techniques that can be utilized within WebStorm, check out this 6 minute video on YouTube.

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: