![]() There are many open-source Kotlin plugins built on the IntelliJ Platform. How to shorten references Example Plugins Implemented in Kotlin Examples: :kotlinx-serialization-json provides JSON serialization for Kotlin projects. Their names start with kotlinx-serialization- and have suffixes that reflect the serialization format. Managing the lifecycle of extensions is the platform responsibility and instantiating these classes as Kotlin singletons may cause issues. All Kotlin serialization libraries belong to the : group. For this reason, plugins must not use Kotlin objects ( object keyword) to implement any plugin.xml declarations. When registering an extension, the platform uses a dependency injection framework to instantiate these classes at runtime. Plugins may use Kotlin classes ( class keyword) to implement declarations in the plugin configuration file. Please see Third-Party Software and Licenses. You can find the current state of the issue in KT-57757. For example, it is common practice to guard logging statements to avoid the cost of parameter construction, leading to the following ceremony when using the log: Likewise, it is easy to customize the behavior of internal classes in the IntelliJ Platform using extensions. Much like Kotlin for Android, the IntelliJ Platform makes extensive use of callbacks, which are easy to express as lambdas in Kotlin. In addition to null safety and type-safe builders, the Kotlin language offers many convenient features for plugin development, which make plugins easier to read and simpler to maintain. Existing plugin developers can get started by converting boilerplate Java classes to their Kotlin equivalents by using the J2K converter (part of Kotlin plugin), and developers can easily mix and match Kotlin classes with their existing Java code. Using Kotlin to write plugins for the IntelliJ Platform is very similar to writing plugins in Java. Advantages of Developing a Plugin in Kotlin See also UAST page for information about how to support multiple JVM languages, including Kotlin. To implement a plugin operating on Kotlin code in the IDE, configure Kotlin plugin dependency ( ). This page describes developing plugins using the Kotlin programming language.
0 Comments
Leave a Reply. |