Developing an Intellij IDEA Plugin for a Custom Language— Tutorial 1-Setting up the environment

As my first intern project at WSO2, Inc I got the chance to develop a plugin for the Siddhi language. Siddhi is a query language which is used inside the WSO2 Complex Event Processor. Building this plugin was a challenging task because the documentation given by @intellijidea on developing a custom plugin is not descriptive enough, specially when implementing the debug functionality in the plugin. So I thought to share my knowledge on developing a custom language plugin for Intellij IDEA.

Custom Language Support

  • File type recognition
  • Lexical analysis
  • Syntax highlighting
  • Formatting
  • Code insight and code completion
  • Debugger support
  • Intention actions
  • Spell Checker
  • Structure View
  • Usage

In this tutorial series I will be working on the above tasks.

So as the first step we need to setup the plugin development environment.

1) Install Intellij IDEA

2) Clone and build IntelliJ IDEA Community Edition source code (optional)

Installing Git

The source code of IntelliJ IDEA Community Edition is stored in a Git repository. Therefore, in order to check out the sources, you need to have Git installed. Check this link to get to know on how to install git.

Checkout the code

You have 2 methods to checkout the code.

  1. Via IntelliJ IDEA:
  • Select VCS ->Checkout from Version Control ->Git from the main menu
  • In the Git Repository URL field, enter git://

2. Checking out from the command line:

Please execute the following command:

git clone --depth 1 git:// idea

Building and running the code

  • Run from the project root directory to check out additional modules.
  • Open the project.
  • If an error notification about a missing required plugin (e.g. Kotlin) is shown enable or install that plugin.
  • Configure a JSDK named “IDEA jdk” (case sensitive), pointing to an installation of JDK 1.8.
  • Unless you’re running on a Mac with an Apple JDK, add /lib/tools.jar to the set of “IDEA jdk” jars.
Image Courtesy:
  • Configure a JSDK named “1.8”, pointing to an installation of JDK 1.8.
  • Add /lib/tools.jar to the set of “1.8” jars.
  • Use Build -> Make Project to build the code.
  • To run the code, use the provided shared run configuration “IDEA”.

3) Configuring IntelliJ Platform SDK

  • Specify the installation folder of IntelliJ IDEA Community Edition as the home directory.
  • Select the IDEA jdk created earlier in step 2 as the default Java SDK:
  • In the Sourcepath tab of the SDK settings, click the Add button:
  • Specify the directory into which you have checked out the sources of the Community Edition:

4) Adding useful plugins

Go to File->Settings->Plugins and search for Plugin Dev kit and enable it if it is not enabled yet.

If your custom language is written using ANTLR4 install the ANTLR v4 grammar plugin. It will be helpful in future work.


Next tutorial will be on Creating a plugin project.

Stay tuned. ;)

Tutorial 02

Senior Software Engineer @WSO2 | Graduate of University of Westminster |