diff --git a/idea/resources/META-INF/completion-stats.xml b/idea/resources/META-INF/completion-stats.xml new file mode 100644 index 00000000000..b66cd9b24cb --- /dev/null +++ b/idea/resources/META-INF/completion-stats.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/idea/resources/META-INF/extensions/ide.xml b/idea/resources/META-INF/extensions/ide.xml index 26539eeb56e..3847a4aefc1 100644 --- a/idea/resources/META-INF/extensions/ide.xml +++ b/idea/resources/META-INF/extensions/ide.xml @@ -70,6 +70,9 @@ + + diff --git a/idea/resources/META-INF/plugin.xml b/idea/resources/META-INF/plugin.xml index cec3145bbab..abb444e76c6 100644 --- a/idea/resources/META-INF/plugin.xml +++ b/idea/resources/META-INF/plugin.xml @@ -29,8 +29,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. org.jetbrains.java.decompiler Git4Idea org.jetbrains.debugger.streams - - com.intellij.stats.completion + com.intellij.stats.completion diff --git a/idea/resources/META-INF/plugin.xml.201 b/idea/resources/META-INF/plugin.xml.201 index 9f7cf1dc2ac..dd0eb3f8df2 100644 --- a/idea/resources/META-INF/plugin.xml.201 +++ b/idea/resources/META-INF/plugin.xml.201 @@ -29,8 +29,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. org.jetbrains.java.decompiler Git4Idea org.jetbrains.debugger.streams - - com.intellij.stats.completion + com.intellij.stats.completion diff --git a/idea/src/org/jetbrains/kotlin/idea/configuration/ExperimentalFeatures.kt b/idea/src/org/jetbrains/kotlin/idea/configuration/ExperimentalFeatures.kt index accbb4c8777..c1bda3c26a7 100644 --- a/idea/src/org/jetbrains/kotlin/idea/configuration/ExperimentalFeatures.kt +++ b/idea/src/org/jetbrains/kotlin/idea/configuration/ExperimentalFeatures.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.idea.configuration +import com.intellij.openapi.extensions.ExtensionPointName import com.intellij.openapi.util.registry.Registry import com.intellij.ui.components.JBCheckBox import org.jdesktop.swingx.VerticalLayout @@ -40,38 +41,28 @@ object ExperimentalFeatures { } } - object MLCompletionForKotlinFeature : ExperimentalFeature { - override val title: String - get() = KotlinBundle.message("experimental.ml.completion") - - override fun shouldBeShown(): Boolean = MLCompletionForKotlin.isAvailable - - override var isEnabled: Boolean - get() = MLCompletionForKotlin.isEnabled - set(value) { - MLCompletionForKotlin.isEnabled = value - } - } - val allFeatures: List = listOf( NewJ2k, - NewWizard, - MLCompletionForKotlinFeature - ) + NewWizard + ) + ExperimentalFeature.EP_NAME.extensionList } -interface ExperimentalFeature { - val title: String - var isEnabled: Boolean - fun shouldBeShown(): Boolean = true - fun onFeatureStatusChanged(enabled: Boolean) {} +abstract class ExperimentalFeature { + abstract val title: String + abstract var isEnabled: Boolean + open fun shouldBeShown(): Boolean = true + open fun onFeatureStatusChanged(enabled: Boolean) {} + + companion object { + internal var EP_NAME = ExtensionPointName("org.jetbrains.kotlin.experimentalFeature") + } } open class RegistryExperimentalFeature( override val title: String, private val registryKey: String, private val enabledByDefault: Boolean -) : ExperimentalFeature { +) : ExperimentalFeature() { final override var isEnabled get() = Registry.`is`(registryKey, enabledByDefault) set(value) { diff --git a/idea/src/org/jetbrains/kotlin/idea/configuration/MLCompletionForKotlin.kt b/idea/src/org/jetbrains/kotlin/idea/configuration/MLCompletionForKotlin.kt index 98f56f2a0c6..48d00383c3b 100644 --- a/idea/src/org/jetbrains/kotlin/idea/configuration/MLCompletionForKotlin.kt +++ b/idea/src/org/jetbrains/kotlin/idea/configuration/MLCompletionForKotlin.kt @@ -6,8 +6,22 @@ package org.jetbrains.kotlin.idea.configuration import com.intellij.completion.settings.CompletionMLRankingSettings +import org.jetbrains.kotlin.idea.KotlinBundle import kotlin.reflect.jvm.isAccessible +object MLCompletionForKotlinFeature : ExperimentalFeature() { + override val title: String + get() = KotlinBundle.message("experimental.ml.completion") + + override fun shouldBeShown(): Boolean = MLCompletionForKotlin.isAvailable + + override var isEnabled: Boolean + get() = MLCompletionForKotlin.isEnabled + set(value) { + MLCompletionForKotlin.isEnabled = value + } +} + internal object MLCompletionForKotlin { const val isAvailable: Boolean = true