What's new in Kotlin plugin 2021.1
This release aims to increase productivity and improve the development experience. Version 2021.1 of the Kotlin plugin introduces the following major updates:
- Performance improvements
- Evaluation of custom getters during debugging
- Improved Change Signature refactoring
- Code completion for type arguments
- UML diagrams for Kotlin classes
- Other platform enhancements
You can also learn about new features in this blog post.
With 2021.1, the Kotlin plugin has received a number of performance improvements that speed up the development process.
Here are some major refinements:
Faster syntax and error highlighting. The code highlighting API has been reworked, so you now get all the necessary diagnostic information faster. See the benchmark results and share your feedback in this YouTrack issue.
Code completion speed improvements. The Kotlin plugin provides faster code completion. Check out this YouTrack issue to see the benchmark results.
This version also introduces other improvements for code completion, particularly code completion for type arguments.
Improved IDE responsiveness. We’ve fixed numerous issues based on your feedback, and we’ve improved the overall stability of the plugin, as well as IDE responsiveness.
Evaluation of custom getters during debugging
This release expands the capabilities of the debugger. One of the most notable features is the ability to display Kotlin properties without a backing field in the Variables view.
Previously, during a debug session, you could only see the properties without 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. Starting with 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 of the following code, you can execute the
get() method to see the value:
In the Debug window, you can see the values of the properties:
Improved Change Signature refactoring
Here are some of the important improvements:
Support for warning messages for more refactoring cases.
Fixes to inheritance refactoring, including cross-language refactoring. See the YouTrack issue for details.* Improved UX of properties processing.
Improved UX for processing properties.
Addition of a way to declare the default parameter value. See the YouTrack issue for details.
Correct backticks processing.
Code completion for type arguments
From now on, code completion will offer functions and properties after generic functions and will restore 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, there is a list of strings to be reversed:
To reverse this list, start typing the name of the
After you apply the code completion suggestion, the IDE automatically adds the
The type argument for
emptyList() is required to evaluate the expression type. Otherwise, the code will not compile.
UML diagrams for Kotlin classes
With this release, you can test Kotlin code visualization via UML Class diagrams. To build a diagram, select Diagrams | Show Diagram... | Kotlin Classes in the Project View.
Currently, the diagrams only show inheritance and nesting relationships. All other more detailed association connections, like aggregation, composition, dependency, and others will be available in the future releases.
Other platform enhancements
Since the plugin and the platform have been moved to the same codebase and now ship simultaneously, this release also brings the following features that improve the Kotlin experience:
You can now launch the basic memory profiler that was announced in the IntelliJ IDEA 2020.3 release via Gradle run.
To improve the experience of working with coroutines, this release provides better thread-blocking call detection. The inspection now correctly warns you about inappropriate blocking method calls.
- We’ve fixed some of the language injection issues that received the most votes. Language injection now works correctly for the following cases: