For CodeTrail, our mission is to enable software developers to document their software better. We do this with IDE-native extensions. Over the last couple of weeks, I’ve been building our IntelliJ platform plugin. In this post, I want to share some ways I managed to increase my velocity building the plugin.
Discovery
Often, I had a vague idea of how I wanted to get started with a feature or extension point. To get started, I would often look at the IntelliJ Platform Plugin SDK documentation. If you need to dig deeper, their search functionality also works well. For example, to get started with building a Tool Window, I’d first check out the Tool Window documentation. The Sample Plugin section is often my next step if I want to understand how it is implemented.
If I really don’t know what kind of module I need in the first place (as their names are sometimes not the first thing that comes to mind), I also consult ChatGPT with a prompt like the following:
How can I select text from some lines when writing a plugin for IntelliJ?
This usually yields some good results. I then try to check out the various classes of the provided code example to learn if they are what I need.
Implementation
When discovering, I might have already tried out one of the examples. But correctly implementing is often a different story. Usually, two strategies work well for me:
- Check out how other plugins implemented the feature: I search for a class or (presumably well-used) snippet on GitHub and check out how other people implement it.
- Check out the IntelliJ source code: I cloned the intellij-community repository on a branch similar to the release version I’m using. Then I can search for how it is done in the IDE itself and bookmark usages I want to explore further.
This already gives me enough context to get started. I iterate over the implementation until I’m satisfied with the result. Sometimes, this takes a while and I need to take a deep look under the hood within IntelliJ’s source code (where I don’t need to use the cloned version and can just use Declaration Lookup).
Testing
Now that I’ve learned a lot on how IntelliJ works, my next step is to embed testing into the greater context. For this, I will come back to this post once I’ve learned more over the holidays.