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:
- Faster code completion and highlighting
- Evaluation of custom getters right in the Variables view
- Change Signature refactoring with better IDE support
- Code completion for type arguments
- Class diagrams for your Kotlin code
- Other IDE improvements
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.
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.
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.
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:
- Detection of more cases where the resulting code may be broken.
- Fixes to inheritance refactoring, including cross-language refactoring.
- Improved UX for processing properties.
- Additional way to declare the default parameter value.
- Correct backtick processing.
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
In the Debug window, you can see the values of the properties:
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
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.
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:
- Use the basic memory profiler that was announced in the IntelliJ IDEA 2020.3 release via Gradle run.
- Get warnings about inappropriate thread-blocking calls in coroutines.
- Avoid language injection issues when using triple quotes and concatenating strings.
Subscribe to Blog updates
Thanks, we've got you!
Kotlin 1.9.0 Released
Kotlin 1.9.0 has been released! Highlights include: Kotlin K2 for JVM is in Beta, other K2 compiler updates, new enum class values function, new operator for open-ended ranges, preview of Gradle configuration cache in Kotlin Multiplatform, changes for Android target support in Kotlin Multiplatform, preview of custom memory allocator in Kotlin/Native. Learn more!
Introducing Kotlin Notebook
The first experimental version of the Kotlin Notebook plugin for IntelliJ IDEA is now available! This post will offer insight into the plugin’s functionality and use cases, but before launching into that, we’d like to let the plugin speak for itself: https://youtu.be/2PLYlDJPelQ W…
Kotlin 1.8.20 Released
Kotlin 1.8.20 has been released! Highlights include: Kotlin K2 compiler updates, AutoCloseable interface and Base64 encoding in stdlib, new JVM incremental compilation enabled by default, new Kotlin/Wasm compiler backend. Learn more!