Disable new inference for IDE analysis by default in releases
This commit is contained in:
+19
-4
@@ -7,18 +7,33 @@ package org.jetbrains.kotlin.idea.project
|
||||
|
||||
import com.intellij.ide.util.PropertiesComponent
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.config.KotlinCompilerVersion
|
||||
import org.jetbrains.kotlin.idea.util.isDev
|
||||
import org.jetbrains.kotlin.idea.util.isEap
|
||||
import org.jetbrains.kotlin.idea.util.isSnapshot
|
||||
|
||||
object NewInferenceForIDEAnalysisComponent {
|
||||
private const val inferenceOption = "kotlin.use.new.inference.for.ide.analysis"
|
||||
const val defaultState = true
|
||||
private const val inferenceOptionV1 = "kotlin.use.new.inference.for.ide.analysis"
|
||||
private const val inferenceOptionV2 = "kotlin.use.new.inference.for.ide.analysis.v2"
|
||||
val defaultState: Boolean
|
||||
get() {
|
||||
val bundledVersion = KotlinCompilerVersion.VERSION
|
||||
return isEap(bundledVersion) || isDev(bundledVersion) || isSnapshot(bundledVersion)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun setEnabled(project: Project, state: Boolean) {
|
||||
PropertiesComponent.getInstance(project).setValue(inferenceOption, state, defaultState)
|
||||
PropertiesComponent.getInstance(project).setValue(inferenceOptionV2, state, defaultState)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isEnabled(project: Project): Boolean {
|
||||
return PropertiesComponent.getInstance(project).getBoolean(inferenceOption, defaultState)
|
||||
return PropertiesComponent.getInstance(project).getBoolean(inferenceOptionV2, defaultState)
|
||||
}
|
||||
|
||||
// This method is preserved only for FUS collector and it shouldn't be used in other contexts
|
||||
@Deprecated("Use isEnabled method instead", replaceWith = ReplaceWith("this.isEnabled(project)"))
|
||||
fun isEnabledForV1(project: Project): Boolean {
|
||||
return PropertiesComponent.getInstance(project).getBoolean(inferenceOptionV1, true)
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,8 @@ class IDESettingsFUSCollector : ProjectUsagesCollector() {
|
||||
|
||||
override fun getUsages(project: Project): Set<UsageDescriptor> {
|
||||
val usages = mutableSetOf<UsageDescriptor>()
|
||||
val inferenceState = NewInferenceForIDEAnalysisComponent.isEnabled(project)
|
||||
@Suppress("DEPRECATION")
|
||||
val inferenceState = NewInferenceForIDEAnalysisComponent.isEnabledForV1(project)
|
||||
val data = FeatureUsageData()
|
||||
.addData("enabled", inferenceState)
|
||||
.addData("pluginVersion", KotlinPluginUtil.getPluginVersion())
|
||||
|
||||
Reference in New Issue
Block a user