- Ensure you have the latest version of the open source Intellij IDEA Community Edition or the commercial edition.
- Launch your copy of IntelliJ IDEA and find its build number (found under
Intellij IDEA -> About Intellij IDEA
on Mac, andHelp -> About
on Linux and Windows). You should see something likeIC-123.169
; the123.169
part is the build number - Clone the IntelliJ IDEA Community Edition GitHub repo
- In your clone of the Community Edition, check out the tag that corresponds to the version of Community Edition you downloaded. All tags for IDEA have the form
idea/<build_number>
, so the command for our example build number above is:
git checkout idea/123.169
- To get the latest tags in your clone, issue the following command:
git pull --tags
- Fork this project, clone it to your machine, and launch IDEA (can be the Community Edition you downloaded above, or some other edition you use in your day-to-day work)
- In IDEA, create a new project of the type Intellij IDEA Plugin, and configure it like the following, with
/projects/idea-silverstripe
replaced with the path where you cloned your fork of the project - If you don't have Intellij IDEA Plugin as an option, ensure that "Plugin DevKit" is enabled in
Settings->Plugins
- If you have not configured any SDKs you need to setup a Java SDK which is the JDK type and point it to your installation of JDK 1.6.
- After you've setup the JDK create a plugin SDK pointing to the install folder of IntelliJ IDEA and linked to the JDK.
- Also note that the Project SDK is set to
IDEA IC-\<build_number\>
. To set this, click "New" and choose the location of your Community Edition install, then choose Java 1.6 when prompted - Click
OK
. Once the project loads up, configure the resources and gen directories:- right-click the "idea-silverstripe/resources" folder, and choose
Mark Directory As->Source Root
- right-click the "idea-silverstripe/gen" folder, and choose
Mark Directory As->Excluded
- right-click the "idea-silverstripe/resources" folder, and choose
- Add the Intellij source code
- Open the "Project Structure" pane (
File -> Product Structure
) - In the
Sourcepath
tab of your IDEA Plugin SDK, add the directory where you cloned the Community Edition source code. This will make debugging and exploring the source much more pleasant.
- Open the "Project Structure" pane (
- Install the following developer plugins
- PsiViewer
- JFlex Support
- Grammar kit is optional
- Configure JFlex
- Open
Settings->JFlex
after you have installed the plugin and configure the path to JFlex and the skeleton file. These files are located intools/lexer/jflex-1.4
andtools/lexer/idea-flex.skeleton
in your cloned IntelliJ IDEA repo. - You also need to turn off External build in
Settings->Compilation
in order for JFLex to be able to regenerate the lexer when you compile the project.
- Open
And that's it! At this point, you should automatically have an idea-silverstripe
Run Configuration in IDEA (if not, create one of type "Plugin" and you should be good to go). If you Run/Debug this configuration, it will launch the Community Edition with your build of the plugin installed.
- Enable Internal Tools: add
-Didea.is.internal=true
to the VM Options of your plugin Run Configurations to add various internal IDEA-development tools to your menu options. Many of these look interesting, but the one you absolutely need isTools -> View PSI Structure of Current File...
- Test against any Jetbrains IDE: you can run your plugin build inside of any IDEA-platform-based IDE (the Ultimate Edition, IDEA 12 EAP, Rubymine, PhpStorm, etc.) by setting up a Plugin SDK pointing at the install location of the IDE you want to test against. You will not have the full source for most of these, but this comes in handy when backporting features, testing against an IDEA EAP, or troubleshooting IDE-specific problems.
- Hack on any open source plugin: these setup instructions should apply for just about any plugin, so now you should be able to easily explore the code of all of your favorite open source plugins.
File an issue! Feel free to suggest improvements, point out gaps, or even just ask questions.