plugin_extensions.md: add "Implementing Extension" section

This commit is contained in:
Yann Cébron 2023-03-23 17:05:55 +01:00
parent a46936de0c
commit f612d4fe95

View File

@ -41,8 +41,7 @@ See [](explore_api.md) for more information and strategies.
* If the extension point was declared using the `beanClass` attribute, set all properties annotated with the [`@Attribute`](%gh-ic%/platform/util/src/com/intellij/util/xmlb/annotations/Attribute.java) and [`Tag`](%gh-ic%/platform/util/src/com/intellij/util/xmlb/annotations/Tag.java) annotations in the specified bean class. * If the extension point was declared using the `beanClass` attribute, set all properties annotated with the [`@Attribute`](%gh-ic%/platform/util/src/com/intellij/util/xmlb/annotations/Attribute.java) and [`Tag`](%gh-ic%/platform/util/src/com/intellij/util/xmlb/annotations/Tag.java) annotations in the specified bean class.
See the [](plugin_extension_points.md#declaring-extension-points) section for details. See the [](plugin_extension_points.md#declaring-extension-points) section for details.
4. Implement the extension API as required. 4. Implement the extension API as required (see [](#implementing-extension)).
**NB:** When using Kotlin, use `class` and never `object` for all implementations ([more details](using_kotlin.md#caution)).
</procedure> </procedure>
@ -73,6 +72,17 @@ and one extension to access the `another.plugin.myExtensionPoint` extension poin
</extensions> </extensions>
``` ```
<procedure id="implementing-extension" title="Implementing Extension">
Please note the following important points:
- Avoid any initialization in constructor, see also notes for [Services](plugin_services.md#constructor).
- Kotlin: Do not use `object` but `class` for implementation ([more details](using_kotlin.md#caution)).
- Kotlin: Do not use `companion object` to avoid excessive classloading/initialization when the extension class is loaded.
Use top-level declarations or objects instead.
</procedure>
### Extension Default Properties ### Extension Default Properties
The following properties are available always: The following properties are available always: