Do you sometimes feel that software engineering is monotonous, repetitive, or even boring? Yeah, sometimes it is, when you become swagger documentation to code converter, or writing for hundredth time persistence handling. Usually framework takes care of such boring tasks, but you will always find something repetitive. This is where you could find IntelliJ plugin development useful.
IntelliJ plugin development
What are IntelliJ plugins good for? When do you need to create IntelliJ plugin and when you should consider other solutions?
IntelliJ’s plugins are great for frameworks and other standardized project creation, maintaining and developing. As one of my plugin development projects, I have created KVision Project Wizard. It allows users to easily create KVision project (KVision kotlin full-stack framework) directly inside IntelliJ IDE. Before, the project template was cloned from GitHub and required to be adjusted manually. Such high entry threshold may scare away potential users. At the end, they might configure the project incorrectly—that is usually very frustrating, so better avoid it.
Other than that, if you work in Software House and you have standardized project structure, with some base classes that are used in each project—Build plugin. Otherwise, you will find yourself inventing the wheel again and again. Of course, it is nonsense to build plugin to generate only a few files at the beginning of the project. In such cases, just create live templates or file templates.
Complex use cases
During development of mobile apps, you will often find yourself in the position of swagger to code converter. It is boring and time-consuming. Why not generate API handler with a plugin? I have created a plugin to generate API handlers for Flutter. Such plugin helps you save a lot of time on writing API handler and also maintaining it, you can always regenerate such classes, all you need is up-to-date Swagger documentation.
Now I am working on a similar plugin for Android apps. In this new plugin, I have also added the feature of “Generic generator”. All you need to do is specify which template needs to be generated, and where. It is a good way to optimize implementation of a new feature, where you need to create several new files with repetitive code (Fragment, ViewModel, Event, State, layout)—but to be honest it can be used for many other purposes. Don’t feel bounded to the example provided, it is generic, so you can use it in your project as you wish.
How long does take IntelliJ plugin development?
Building plugin for IntelliJ usually does not take that much time. For example KVision project wizard took me around 1-2 weeks, but I don’t remember well right now. Generally Intellij plugin development is quite easy, the hardest part is finding proper information in documentation about some specific features. IntelliJ Platform SDK is well documented but only as “Getting Started”.
When you want to implement more advanced features with use of some plugins (for example Gradle), you will need to deep dive into open source plugins on GitHub (Android plugin is good repository for this). What I also find troublesome, is building UI. It is overdated. While building IntelliJ and other IDEs Jetbrains used AWT. AWT is an old UI library for Java, so creating UI for your plugin will not be easy, and you will be limited in terms of styling the UI. Nonetheless, you should be able to implement all the features you will need.
I have found IntelliJ plugin development skills helpful in many types of jobs: full-time job, freelance job, open source contribution. It highly increases my productivity in repetitive tasks and makes it easier to setup new projects. However it is worth remembering about existing Intellij features (live templates, file templates) to not end up overengineering and inventing a wheel for a hundredth time.