diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaInheritorsCodeVisionProvider.kt b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaInheritorsCodeVisionProvider.kt index b4314ce2583b..a8f616b8a4d6 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaInheritorsCodeVisionProvider.kt +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaInheritorsCodeVisionProvider.kt @@ -41,7 +41,7 @@ class JavaInheritorsCodeVisionProvider : InheritorsCodeVisionProvider() { return null } - override fun logClickToFUS(element: PsiElement) { + override fun logClickToFUS(element: PsiElement, hint: String) { val location = if (element is PsiClass) JavaCodeVisionUsageCollector.CLASS_LOCATION else JavaCodeVisionUsageCollector.METHOD_LOCATION JavaCodeVisionUsageCollector.IMPLEMENTATION_CLICKED_EVENT_ID.log(element.project, location) } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaReferencesCodeVisionProvider.kt b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaReferencesCodeVisionProvider.kt index aaa889aa357f..c5d957f28eae 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaReferencesCodeVisionProvider.kt +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaReferencesCodeVisionProvider.kt @@ -21,7 +21,7 @@ class JavaReferencesCodeVisionProvider : ReferencesCodeVisionProvider() { override fun getHint(element: PsiElement, file: PsiFile): String? = JavaTelescope.usagesHint(element as PsiMember, file) - override fun logClickToFUS(element: PsiElement) { + override fun logClickToFUS(element: PsiElement, hint: String) { JavaCodeVisionUsageCollector.USAGES_CLICKED_EVENT_ID.log(element.project) } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hints/codeVision/CodeVisionProviderBase.kt b/platform/lang-impl/src/com/intellij/codeInsight/hints/codeVision/CodeVisionProviderBase.kt index 976580ad95aa..2c62120126a5 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/hints/codeVision/CodeVisionProviderBase.kt +++ b/platform/lang-impl/src/com/intellij/codeInsight/hints/codeVision/CodeVisionProviderBase.kt @@ -34,7 +34,10 @@ abstract class CodeVisionProviderBase : DaemonBoundCodeVisionProvider { */ abstract fun getHint(element: PsiElement, file: PsiFile): String? - open fun logClickToFUS(element: PsiElement) {} + /** + * @param hint result of [getHint] + */ + open fun logClickToFUS(element: PsiElement, hint: String) {} override fun computeForEditor(editor: Editor, file: PsiFile): List> { if (!acceptsFile(file)) return emptyList() @@ -52,7 +55,7 @@ abstract class CodeVisionProviderBase : DaemonBoundCodeVisionProvider { if (!InlayHintsUtils.isFirstInLine(element)) continue val hint = getHint(element, file) if (hint == null) continue - val handler = ClickHandler(element) + val handler = ClickHandler(element, hint) val range = InlayHintsUtils.getTextRangeWithoutLeadingCommentsAndWhitespaces(element) lenses.add(range to ClickableTextCodeVisionEntry(hint, id, handler)) } @@ -60,14 +63,15 @@ abstract class CodeVisionProviderBase : DaemonBoundCodeVisionProvider { } private inner class ClickHandler( - element: PsiElement + element: PsiElement, + private val hint: String, ) : (MouseEvent?, Editor) -> Unit { private val elementPointer = SmartPointerManager.createPointer(element) override fun invoke(event: MouseEvent?, editor: Editor) { if (isInlaySettingsEditor(editor)) return val element = elementPointer.element ?: return - logClickToFUS(element) + logClickToFUS(element, hint) handleClick(editor, element, event) } }