Kotlin logo

The Kotlin Blog

Kotlin Programming Language by JetBrains

Releases

Kotlin Plugin 2021.1 Released: Improved IDE Performance and Better Support for Refactorings

The newest release of IntelliJ IDEA, version 2021.1, comes with the improved Kotlin plugin. Enjoy an improved developer experience with faster code completion and highlighting, change signatures with better IDE support, benefit from better debugging experience for evaluating properties, and more.

Here is what you’ll get by installing the new plugin:

Auto-update to this new release

IntelliJ IDEA will give you the option to automatically update to the new release once it is out.

If you are not yet an IntelliJ IDEA user, you can download the newest version and it will already come bundled with the latest Kotlin plugin.

Enjoy quick code completion and highlighting

Sometimes writing code may not be as much fun as it could be, especially if you need to wait for the IDE to highlight your code and help you with completion. Our goal is to make code highlighting and completion seamless for you.

The new Kotlin plugin significantly improves performance for Kotlin code highlighting and completion.

Based on our tests, highlighting speed has improved by about 25% and code completion is now more than 50% faster, which brings it much closer to the performance level offered for Java.

Note that these numbers are just based on our tests. The improvements in your actual projects may not be as significant as our tests show, but you should notice much better performance.

Kotlin code highlighting in the new plugin

Here you can see a comparison of the speed of Kotlin code highlighting between the previous Kotlin plugin, version 2020.3, and the new one, version 2021.1. The results are based on our benchmark tests that check code highlighting in complex Kotlin files.

Faster Kotlin code highlighting

Kotlin code completion in the new plugin

And here is a comparison of the performance of Kotlin code completion between version 2020.3 and version 2021.1. The results are based on our benchmark tests that check code completion in complex Kotlin files.

Faster Kotlin code completion

Change signature with better IDE support

If you’ve used the Change Signature refactoring in previous versions of the Kotlin plugin, you may have encountered issues and limitations, as well as a lack of visibility regarding what went wrong in those cases.

Update to the new Kotlin plugin to reap the benefits of more than 40 bug fixes and improvements to the Change Signature refactoring.

Here are some of the most important improvements:

Evaluate custom getters right in the Variables view

Based on our research, the debugging experience for Kotlin requires significant improvements to deliver a better developer experience, and we already have a number of plans in the works to provide them.

This release provides a small but important improvement for evaluating properties in the Variables view.

Previously, during a debug session, you could only see the properties that didn’t have a custom getter and those with a backing field. Properties with a custom getter didn’t appear because they are represented as regular methods on the JVM. In version 2021.1 of the Kotlin plugin, you can see all such properties and evaluate them on demand by clicking on get() near the property name.

For example, when debugging the following code, you can execute the get() method to see the versionString value:

In the Debug window, you can see the values of the properties:

Debugging in Variables view

We would greatly appreciate it if you could try this feature out and provide your feedback in this ticket or as comments to this blog post.

Use code completion for type arguments

The new Kotlin plugin can now complete code for type arguments. Previously, you had to write this code manually without the benefit of the IDE’s assistance features.

Now code completion suggests functions and properties after generic functions and restores type arguments where needed. When you select such a function from the list, the IDE adds the correct type argument to the preceding code.

In the following example, the IDE automatically adds the <String>() type:

Code completion for type arguments

After you apply the IDE’s suggestion, you’ll get the following code:

Review the structure of your Kotlin code with class diagrams

With the new release, you can review the structure of your Kotlin code via UML Class diagrams. To build a diagram, select Diagrams | Show Diagram… | Kotlin Classes in the Project View.

UML Class diagrams for Kotlin code

Benefit from other IDE improvements

Since the Kotlin plugin and the IntelliJ Platform have been moved to the same codebase and now ship simultaneously, you will also have the ability to do the following to benefit your Kotlin experience:

See also

Discover more