扩展程序生存期由 IntelliJ 平台管理。 使用 Kotlin 对象进行扩展程序注册可能会导致创建不必要的扩展程序实例,并使插件无法卸载。
扩展程序注册:
<annotator language="myLang" implementationClass="com.example.MyAnnotator"/>
扩展程序实现:
// 错误:
object MyAnnotator : Annotator {
...
}
// 正确:
class MyAnnotator : Annotator {
...
}
2023.1 最新变化