Development IntelliJ Marketplace

Guest Post: 5 Things You Should Know Before Coding an IntelliJ Platform Plugin

This is a guest blog post by Jules Faucherre, Software Engineer at Ponicode.

Hello, my name is Jules. I am a software engineer at Ponicode, a startup company dedicated to making code quality even more accessible than ever. One of my latest projects was to manage the development and deployment of our first plugin for IntelliJ IDEA. This plugin is designed to help developers achieve high code coverage by generating unit tests in bulk for Java applications.

As I was progressing through the different stages of this project, I had to learn a lot about the IntelliJ Platform ecosystem. There are things I wish I had known before creating this plugin, which would have saved me a lot of time. That is why I have put together a list of the top 5 things you should know when developing a plugin for IntelliJ-based IDEs.

1. Take the time to get to know IntelliJ IDEA

The first thing that I’ve learned from developing my first IntelliJ-based plugin was that you should develop it – drumroll – in IntelliJ IDEA. If you are not familiar with the IDE yet, you’ll see how quick to onboard it is. One thing that will change your life forever is Show Context Actions. Press Alt+Enter and you will instantly see suggestions on how to make your code better or fix some problems. Another benefit of using IntelliJ IDEA is that you are able to put yourself in the shoes of the users and understand the IDE you are building a plugin for. At the end of the day, if you are like me, you will probably end up switching to it as your main IDE thanks to the really cool features it provides.

2. Thoroughly plan your project timeline and implementation

I assume that JetBrains is extra careful with the quality and the content of the plugins published on the Marketplace because every update you publish is reviewed manually. Don’t let yourself be surprised by this delay. Make sure to plan ahead and add two business days to your project timeline. Fortunately, we always received approval within one day.

3. Add these useful scripts to your CI

Here are 2 scripts that you should definitely add to your CI workflow:

a. A custom script that will make sure you always support the latest version of IntelliJ IDEA. We actually got caught off guard when a user notified us that they couldn’t use our extension because we had missed one of the JetBrains releases. Fortunately, JetBrains provides an API  that allows you to always keep your IntelliJ-based plugin’s configuration updated.

b. A Gradle task runPluginVerifier, which is a script verifying the compatibility of your code against the IntelliJ-based IDE versions that your plugin supports. This task can stop you publishing if the plugin is not compatible.

Note that it is important to run a. before b. because you want the versions added by a. to be verified by b.

Editor’s note: With the latest updates, Gradle IntelliJ Plugin enhanced the runPluginVerifier task, so now it is possible to omit the IDE versions to check and they’ll be resolved automatically – from the version you target until the latest stable release.

4. Take some time to explore the code samples

The good news is IntelliJ Platform has a very well-documented plugin API. The bad news is that you might get lost in this incredible amount of documentation. IntelliJ-based IDEs can be extended in so many ways, but you must integrate with their way of interpreting code. As an example, you can add support for your custom language.

Don’t be put off by the sheer volume of documentation. I personally found my way around making our plugin easily thanks to the crystal clear, well-documented code examples. Don’t hesitate to navigate the IntelliJ Platform implementations with the Go to definition IDE action to find a piece of code that does what you want. You can use IntelliJ Platform Explorer to browse Extension Points inside existing implementations of open-source IntelliJ Platform plugins.

5. Ask questions, lots of them

IntelliJ IDEA is not a new IDE, this rich application is full of incredible functionality and a broad scope of possibilities that you can exploit to enhance your plugin’s user experience. It is important to remember that you are not alone in your quest, the JetBrains team and the community have shown us amazing support throughout our project. The JetBrains Platform Slack community they have is amazing, I would recommend joining it early and asking your questions!

For example, I remember spending a lot of time researching how to open IntelliJ IDEA from a browser before finally asking for help, just to discover that it had been implemented a while ago and that it was only referenced in a deep thread of JetBrains forums. So next time, if you spend more than a few hours searching for something just stop right there and go and ask. :-)

In conclusion

I hope you found this advice helpful. As you might have guessed from reading this article, coding my first plugin and deploying it was in no way uneventful, but overall, it was a pretty seamless experience because the whole IntelliJ Platform environment is well organized. I can only encourage you to start your own plugin and enjoy the learning curve of such a project. And of course please don’t hesitate to give our plugin a try and share your feedback with us so that we can continue improving it and making code quality easier than ever for all IntelliJ Platform users.

About the Author

Jules Faucherre

Jules is a software engineer at Ponicode. He has spent the last 4 years of his career exploring the software industry as a full stack developer. He is specifically familiar with solutions leveraging the power of artificial intelligence (AI-powered image analysis and AI-powered software tests). Jules loves functional programming and he’s always exploring new languages, new concepts, and new programming techniques.

image description