plugin_extensions.md: cleanup

This commit is contained in:
Yann Cébron 2023-09-06 17:15:32 +02:00
parent aae32db25b
commit 1531f47291

View File

@ -12,7 +12,7 @@ The following are some of the most common tasks accomplished using extensions:
* The `com.intellij.applicationConfigurable` and `com.intellij.projectConfigurable` extension points allow plugins to add pages to the [Settings dialog](settings.md);
* [Custom language plugins](custom_language_support.md) use many extension points to extend various language support features in the IDE.
There are more than 1000 extension points available in the platform and the bundled plugins, allowing customizing different parts of the IDE behavior.
There are more than 1500 extension points available in the platform and the bundled plugins, allowing customizing different parts of the IDE behavior.
## Exploring Available Extensions
@ -76,23 +76,27 @@ and one extension to access the `another.plugin.myExtensionPoint` extension poin
Please note the following important points:
- Extension implementations should be stateless. Use explicit [](plugin_services.md) for managing (runtime) data.
- Extension implementations must be stateless. Use explicit [](plugin_services.md) for managing (runtime) data.
- Avoid any initialization in constructor, see also notes for [Services](plugin_services.md#constructor).
When using Kotlin:
When using [Kotlin](using_kotlin.md):
- Do not use `object` but `class` for implementation. [More details](using_kotlin.md#object-vs-class)
- Do not use `companion object` to avoid excessive classloading/initialization when the extension class is loaded.
Use top-level declarations or objects instead. [More details](using_kotlin.md#companion-object-extensions)
Use top-level declarations or objects instead. [More details](using_kotlin.md#companion-object-extensions)
</procedure>
### Extension Default Properties
The following properties are available always:
`id`
: Unique ID. Consider prepending ID with the prefix related to the plugin name or ID to not clash with other plugins defining extensions with the same ID, e.g., `com.example.myplugin.myExtension`.
* `id` - unique ID. Consider prepending ID with the prefix related to the plugin name or ID to not clash with other plugins defining extensions with the same ID, e.g., `com.example.myplugin.myExtension`.
* `order` - allows ordering all defined extensions using `first`, `last` or `before|after [id]` respectively
* `os` - allows restricting an extension to given OS, e.g., `os="windows"` registers the extension on Windows only
`order`
: Allows ordering all defined extensions using `first`, `last` or `before|after [id]` respectively.
`os`
: Allows restricting an extension to given OS, e.g., `os="windows"` registers the extension on Windows only
If an extension instance needs to "opt out" in certain scenarios, it can throw [`ExtensionNotApplicableException`](%gh-ic%/platform/extensions/src/com/intellij/openapi/extensions/ExtensionNotApplicableException.java) in its constructor.
@ -104,6 +108,7 @@ Properties annotated with [`RequiredElement`](%gh-ic%/platform/core-api/src/com/
If the given property is allowed to have an explicit empty value, set `allowEmpty` to `true` (2020.3 and later).
Property names matching the following list will resolve to fully qualified class name:
- `implementation`
- `className`
- `serviceInterface` / `serviceImplementation`
@ -112,6 +117,7 @@ Property names matching the following list will resolve to fully qualified class
A required parent type can be specified in the extension point declaration via nested [`<with>`](plugin_configuration_file.md#idea-plugin__extensionPoints__extensionPoint__with):
```xml
<extensionPoint name="myExtension" beanClass="MyExtensionBean">
<with
attribute="psiElementClass"