The 8 best IntelliJ plugins for improving your coding experience
2021年8月26日
0 分で読めますFor many developers, a good IDE is like a Swiss Army knife. It is a tool that integrates all sorts of features you need as a developer in a single program. Therefore many developers primarily work from their favorite IDE instead of opening multiple single-purpose tools.
The recently released JVM Ecosystem report 2021 shows that IntelliJ IDEA is by far the most used IDE in the Java ecosystem. However, the report also indicates that more than half of the developers use multiple IDEs on their local system. Therefore you might want to enrich your IDE with extensions or plugins that suit your needs and increase usability. This post will suggest eight production-grade plugins that are freely available on the marketplace and improve your coding experience.
The current versions of IntelliJ IDEA already provide many plugins bundled with IDE, including Maven, Gradle, Lombok, Docker, and many more. The JetBrains folks also provide a ton of plugins for specific languages and frameworks. This is one of the reasons these plugins nearly always work seamlessly with IntelliJ IDEA. However, in this post, I will focus on great additional plugins, from mainly third parties, that bring something extra to your daily routines.
1. Maven Helper
In the Java Ecosystem, Maven is still the most used build system that also provides dependency management. The Maven Helper plugin by Vojtech Krassa provides some easy tools to navigate your dependencies in, for instance, a tree view and find dependency conflicts.
Next to this, you can predefine and combine Maven goals that you can run with the click of a button or from a context menu. This includes running plugin goals. In the example below, I created an extra goal that calls the package goal and skips the test.
2. Rainbow Brackets
This is a small, simple, and elegant plugin that can make your life much easier. Rainbow Brackets use different colors for brackets and parentheses when they are nested. Now it is far easier to recognize where a parenthesized statement ends without hovering over it.
It works for many languages like Java, Scala, Clojure, Kotlin, Python, Haskell, Agda, Rust, JavaScript, TypeScript, Erlang, Go, Groovy, Ruby, Elixir, ObjectiveC, PHP, HTML, XML, SQL, Apex language, C#, Dart, Pug/Jade, Bash, Vue.js
The Java example below makes the line with the String.format()
much easier to read using the different colored parentheses. In addition, since the plugin supports Clojure, maybe this is the silver bullet that makes Clojure syntax less unreadable for us mortals.
3. Presentation Assistant
Part of my job is giving presentations. This also includes a lot of live coding. Every time I call a function using a keyboard shortcut, the Presentation Assistant plugin shows the function and the key combo I use in the button. This makes it super easy for people to follow and re-create what I am doing.
In addition, if I call a function using my mouse pointer, it also shows the message, including the short key. This means whenever I am using the mouse to call a feature in IntelliJ and there is a short key available, I see and learn the key combo right away.
4. RoboPOJOGenerator
Connecting your application to a REST endpoint is quite a common task nowadays. In most cases, you want to transform the JSON output from the endpoint into an object representation in your application. Manually creating objects for large JSON outputs can be quite a painful exercise. Luckily the RoboPOJOGenerator plugin can do the heavy lifting for you. Simple put the JSON output into the generator and optionally choose the frameworks you want to use. RoboPOJOGenerator creates the POJO (Plain Old Java Objects) with the annotations matching the frameworks you choose for Java and Kotlin. In my opinion, this is a great time-saving plugin!
5. Snyk Vulnerability Scanner
The Snyk Vulnerabilty Scanner plugin helps you develop your Java applications more securely. It is able to scan both your third-party dependencies for known security issues, as well as your custom code.
For your open source dependencies, it will provide remediation advice to a package that does not include the vulnerability. If the vulnerable package is a transitive dependency, this plugin will provide information about which top-level version you need to update. If there is no fixed top-level dependency it will tell you if and what version of the transitive dependency solves the security problem.
For you custom code, the Snyk Vulnerabilty Scanner recognizes vulnerable code constructions like SQL injection, cross-site scripting (XSS) and path traversal issues. It will show you where this happens in your code, the vulnerability’s flow, and possible solutions that might guide you to safety gathered from open source code. It is like a spell checker for your code, preventing security mistakes.
For more information on this plugin read the blog post: How to fix Java security issues while coding in IntelliJ IDEA
6. AsciiDoc
I love AsciiDoc. Although it feels similar to Markdown, AsciiDoc is a text format that is highly configurable for most people. You can convert AsciiDoc to formats like PDF, EPUB, HTML, and much more.
The AsciiDoc plugin makes it easy to create and edit AsciiDoc files in my editor and preview it. I use it, for instance, to write documentation around my code that we can output to a web HTML page, but also to a PDF is someone rather has that.
Doing this right in my IDE is very strong and with over 2.1M downloads, I am not the only one that values this great extension to my IntelliJ IDEA.
7. Randomness
The Randomness plugin is a small, nifty tool. The first time I saw this tool I honestly thought, “Ok, this might be interesting but how much do I really use it?” It turns out that I use it a lot more than expected at first sight. This tool creates random data for you like Number, Strings actual Words and UUID’s. It cal also create arrays of a type.
As I am giving a lot of demos, this is super handy that I can create random data or a collection of data with a keyboard shortcut. I also use it in my Unit tests to create random tests. This plugin’s output is highly configurable so you can shape it to your own needs.
A few examples are: the size of an array, the character set used for a random String, and the size of a word. The only real thing I changed is that an array does not output the brackets []
anymore, but just the content. This way I can easily create a List
with the List.of()
method in Java like below.
8. SonarLint
The SonarLint plugin is a great plugin for code quality assurance. It helps you identify code smells, bad habits and possible bugs in your code. By default, it will use static rules roughly based on an aggregation of the PMD, findbugs and checkstyle rules. The nice thing about this plugin is that it shows you information on the fly and integrates with the git capabilities of IntelliJ. Before you commit your code, this plugin warns you if there are issues with your code.
If you are using sonarQube or sonarCloud you can sync this with your local sonarLint to match your code to the same ruleset. Nevertheless, it is also a great asset for any developer when using it stand alone.
Earlier, we already spoke about the Snyk Vulnerability Scanner. If I compare it to sonarLint, I wouldn’t say it is redundant. On the contrary, while SonarLint might find some issues that can also be security-related, it is not the main focus of SonarLint and Snyk is much better at this. The other way around SonarLint is currently far better at finding all sorts of possible bugs and styling issues than the Snyk plugin. At the end of the day, I personally use both plugins simultaneously, and I feel they complement each other.