Report only safe-to-report postfix templates (FUS-173)

This commit is contained in:
Alexander Zolotov
2019-01-21 12:16:33 +03:00
parent 096a7e62c6
commit 1d1f900704
@@ -11,6 +11,7 @@ import com.intellij.diagnostic.AttachmentFactory;
import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.internal.statistic.eventLog.FeatureUsageGroup;
import com.intellij.internal.statistic.eventLog.FeatureUsageLogger;
import com.intellij.internal.statistic.utils.PluginInfoDetectorKt;
import com.intellij.internal.statistic.utils.StatisticsUtilKt;
import com.intellij.lang.Language;
import com.intellij.lang.LanguageUtil;
@@ -231,8 +232,10 @@ public class PostfixLiveTemplate extends CustomLiveTemplateBase {
@NotNull final PsiElement context) {
if (template.isBuiltin()) {
PostfixTemplateProvider provider = template.getProvider();
String action = provider != null ? provider.getId() + "/" + template.getId() : template.getId();
FeatureUsageLogger.INSTANCE.log(USAGE_GROUP, action, StatisticsUtilKt.createData(context.getProject(), null));
if (PluginInfoDetectorKt.getPluginInfo(provider != null ? provider.getClass() : template.getClass()).getType().isSafeToReport()) {
String action = provider != null ? provider.getId() + "/" + template.getId() : template.getId();
FeatureUsageLogger.INSTANCE.log(USAGE_GROUP, action, StatisticsUtilKt.createData(context.getProject(), null));
}
}
if (template.startInWriteAction()) {
ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor.getInstance()