Thursday, August 19, 2010

A first stab at an IntelliJ plugin

While I'm not the biggest fan of IntelliJ's IDEA, I have been using it an awful lot lately. The IDE definitely has some neat features such as their Live Templates. One can get away with all kinds of tricks using the Live Template stuff; but not what I wanted.

What I really wanted was an added "Generator" for generating Chained setter methods (i.e. public T setF(F f){this.f=f;return this;})

I've spent some time working on eclipse plugins (about five years ago) so I figured I'd check out IDEA's plugin API.  Not having high expectations, I was pleasantly surprised and managed to actually knock out a plugin that does exactly what I wanted in just a few hours.  The API documentation appears scarce but luckily there seem to be quite a few open-source plugins out there.  Browsing through a few of these made comprehending the API a breeze (granted - I am doing something extremely simple here).  The "Basics of Plugin Development" document was also pretty nifty.

IntelliJ provides a neat web interface you can use to upload plugins, so I've uploaded my plugin (generate-chained-accessors) and put it up on google code.  It was pretty neat to see the plugin appear as an available plugin in the IDE almost immediately after it was uploaded to IntelliJ's website.