Shiraji's Blog

Tips for Creating Intellij Plugin in Kotlin

This is the second blog post for “Tips of creating Intellij plugin”.

This entry is focus on tips for creating intellij plugin in Kotlin. (But I still believe it is useful for Java developers.)

For more basic tips, please read Tips for Creating Intellij Plugin


  • How to find parent
  • How to find children
  • How to find files

How to Kontribute (for Japanese)

This entry is for Japanese. For English speaker, please refer kotlin repo




How to Create Intellij Custom Wizard

Japanese text is following.(日本語は英語の下です。)


When I created Intellij custom wizard called gradle-intellij-plugin wizard, I read JetBrains official documentation. They explains how to support module types and how to add new steps. However, what I want to know is how to add custom fields, how to add custom files, and how to customize files based on custom fields.

There is no such documentation at this point, so I decided to write this entry for me.


  • How to add custom view
  • How to get the user input in ModuleWizardStep
  • How to create a file
  • How to change the file contents

Difference Between Generating Java and Generating Kotlin for Developing IntelliJ Plugin


I am a maintainer of PermissionsDispatcher Plugin which generates Java and Kotlin for PermissionsDispatcher Since Kotlin is getting famous for Android developers, I thought IntelliJ plugins, which generate Android code, should support both Java and Kotlin. (By the way, Kotlin 1.0.2 now supports Android lint! This definitely will lead more developers use Kotlin!)

However, while I was developing this plugin, I found really hard to generate both Java and Kotlin code.

So, this blog post describes what are the differences between generating Java and generating Kotlin using IntelliJ plugin.

Tips for Creating Intellij Plugin


There are tips for creating intellij plugins

  • Logging
  • plugin.xml
  • Action

This is note for myself. I won’t add description if the sample is clear enough for me.

ForwardingAstVisitor's Life Cycle (Android Lint)


  • ForwardingAstVisitor has life cycle
  • visitXxx -> afterXxx -> endXxx
  • Begin visitCompilationUnit, End afterVisitCompilationUnit
  • Go from top to bottom. No surprise, except annotation.
  • Does not talk about visitIf or any of visitXxx where Xxx is keyword

Custom Lint for Library


  • PermissionsDispatcher now have a custom lint
  • Adding custom lint is not that hard
  • LintDetectorTest…? Forget it



勉強出来そうなプロジェクトを選らんで、pull requestを投げて、レビューしてもらうと勉強になるよ。




  • リファクタリングする=サービスの開発が停止すると考えている方
  • リファクタリングに関して価値を見出せない方
  • エンジニアにリファクタリングさせて欲しいと言われる方