Collect statistics for inlay parameter options

This commit is contained in:
Nikolay Krasko
2018-03-27 15:23:21 +03:00
parent 8d4fa8f3e8
commit 9a831bf7dd
2 changed files with 30 additions and 0 deletions
+1
View File
@@ -2795,6 +2795,7 @@
serviceImplementation="org.jetbrains.uast.kotlin.internal.IdeaKotlinUastBindingContextProviderService"/>
<statistics.usagesCollector implementation="org.jetbrains.kotlin.idea.formatter.KotlinFormatterUsageCollector" />
<statistics.usagesCollector implementation="org.jetbrains.kotlin.idea.parameterInfo.KotlinInlayParameterHintsUsageCollector" />
</extensions>
<xi:include href="tipsAndTricks.xml" xpointer="xpointer(/idea-plugin/*)"/>
@@ -0,0 +1,29 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.parameterInfo
import com.intellij.codeInsight.hints.InlayParameterHintsExtension
import com.intellij.internal.statistic.UsagesCollector
import com.intellij.internal.statistic.beans.GroupDescriptor
import com.intellij.internal.statistic.beans.UsageDescriptor
import com.intellij.internal.statistic.utils.getBooleanUsage
import org.jetbrains.kotlin.idea.KotlinLanguage
class KotlinInlayParameterHintsUsageCollector : UsagesCollector() {
override fun getGroupId(): GroupDescriptor = GroupDescriptor.create(GROUP_ID)
override fun getUsages(): Set<UsageDescriptor> {
val provider = InlayParameterHintsExtension.forLanguage(KotlinLanguage.INSTANCE) ?: return emptySet()
return provider.supportedOptions.mapTo(LinkedHashSet()) {
getBooleanUsage(it.id, it.get())
}
}
companion object {
private const val GROUP_ID = "kotlin.hints.inlay"
}
}