diff --git a/spellchecker/src/META-INF/SpellCheckerPlugin.xml b/spellchecker/src/META-INF/SpellCheckerPlugin.xml index 3ffb9495cffc..cfc1e6c8ede1 100644 --- a/spellchecker/src/META-INF/SpellCheckerPlugin.xml +++ b/spellchecker/src/META-INF/SpellCheckerPlugin.xml @@ -33,5 +33,6 @@ + diff --git a/spellchecker/src/com/intellij/spellchecker/quickfixes/ChangeTo.java b/spellchecker/src/com/intellij/spellchecker/quickfixes/ChangeTo.java index 4d63110e76ca..75dff039b10b 100644 --- a/spellchecker/src/com/intellij/spellchecker/quickfixes/ChangeTo.java +++ b/spellchecker/src/com/intellij/spellchecker/quickfixes/ChangeTo.java @@ -4,6 +4,7 @@ package com.intellij.spellchecker.quickfixes; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElementBuilder; import com.intellij.codeInsight.lookup.LookupManager; +import com.intellij.codeInsight.lookup.impl.LookupImpl; import com.intellij.codeInspection.ProblemDescriptor; import com.intellij.codeInspection.ProblemDescriptorBase; import com.intellij.ide.DataManager; @@ -17,6 +18,7 @@ import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiElement; import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; +import com.intellij.spellchecker.statistics.SpellcheckerLookupUsageDescriptor; import com.intellij.spellchecker.util.SpellCheckerBundle; import org.jetbrains.annotations.NotNull; @@ -67,7 +69,10 @@ public class ChangeTo extends ShowSuggestions implements SpellCheckerQuickFix { .stream() .map(LookupElementBuilder::create) .toArray(LookupElement[]::new); - LookupManager.getInstance(project).showLookup(editor, items); + final LookupImpl lookup = (LookupImpl)LookupManager.getInstance(project).showLookup(editor, items); + if (lookup != null) { + lookup.putUserDataIfAbsent(SpellcheckerLookupUsageDescriptor.Companion.getSPELLCHECKER_KEY(), true); + } }); } diff --git a/spellchecker/src/com/intellij/spellchecker/statistics/SpellcheckerLookupUsageDescriptor.kt b/spellchecker/src/com/intellij/spellchecker/statistics/SpellcheckerLookupUsageDescriptor.kt new file mode 100644 index 000000000000..6c8536ef4fc2 --- /dev/null +++ b/spellchecker/src/com/intellij/spellchecker/statistics/SpellcheckerLookupUsageDescriptor.kt @@ -0,0 +1,25 @@ +// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package com.intellij.spellchecker.statistics + +import com.intellij.codeInsight.lookup.Lookup +import com.intellij.codeInsight.lookup.impl.LookupImpl +import com.intellij.codeInsight.lookup.impl.LookupUsageDescriptor +import com.intellij.internal.statistic.eventLog.FeatureUsageData +import com.intellij.openapi.util.Key + +class SpellcheckerLookupUsageDescriptor : LookupUsageDescriptor { + companion object { + private const val SPELLCHECKER = "spellchecker" + val SPELLCHECKER_KEY = Key(SPELLCHECKER) + } + + override fun getExtensionKey(): String = SPELLCHECKER + + override fun fillUsageData(lookup: Lookup, usageData: FeatureUsageData) { + if (lookup is LookupImpl && lookup.getUserData(SPELLCHECKER_KEY) == true) { + usageData.apply { + addData(SPELLCHECKER, true) + } + } + } +} \ No newline at end of file