diff --git a/idea-plugin/src/main/kotlin/org/jetbrains/compose/desktop/ide/preview/PreviewEntryPoint.kt b/idea-plugin/src/main/kotlin/org/jetbrains/compose/desktop/ide/preview/PreviewEntryPoint.kt index 1d6c274c8b..f378e10d12 100644 --- a/idea-plugin/src/main/kotlin/org/jetbrains/compose/desktop/ide/preview/PreviewEntryPoint.kt +++ b/idea-plugin/src/main/kotlin/org/jetbrains/compose/desktop/ide/preview/PreviewEntryPoint.kt @@ -37,7 +37,8 @@ class PreviewEntryPoint : EntryPoint() { override fun isEntryPoint(refElement: RefElement, psiElement: PsiElement): Boolean = isEntryPoint(psiElement) override fun isEntryPoint(psiElement: PsiElement): Boolean = - psiElement is PsiMethod && psiElement.hasAnnotation(DESKTOP_PREVIEW_ANNOTATION_FQN) + psiElement is PsiMethod && (psiElement.hasAnnotation(DESKTOP_PREVIEW_ANNOTATION_FQN) || + psiElement.hasAnnotation(COMMON_PREVIEW_ANNOTATION_FQN)) override fun readExternal(element: Element) = element.deserializeInto(this) diff --git a/idea-plugin/src/main/kotlin/org/jetbrains/compose/desktop/ide/preview/locationUtils.kt b/idea-plugin/src/main/kotlin/org/jetbrains/compose/desktop/ide/preview/locationUtils.kt index c802e6369d..b98baeb775 100644 --- a/idea-plugin/src/main/kotlin/org/jetbrains/compose/desktop/ide/preview/locationUtils.kt +++ b/idea-plugin/src/main/kotlin/org/jetbrains/compose/desktop/ide/preview/locationUtils.kt @@ -32,6 +32,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode internal const val DESKTOP_PREVIEW_ANNOTATION_FQN = "androidx.compose.desktop.ui.tooling.preview.Preview" +internal const val COMMON_PREVIEW_ANNOTATION_FQN = "org.jetbrains.compose.ui.tooling.preview.Preview" internal const val COMPOSABLE_FQ_NAME = "androidx.compose.runtime.Composable" /** @@ -120,7 +121,9 @@ internal fun KtNamedFunction.isValidComposablePreviewFunction(): Boolean { while (annotationIt.hasNext() && !(hasComposableAnnotation && hasPreviewAnnotation)) { val annotation = annotationIt.next() hasComposableAnnotation = hasComposableAnnotation || annotation.fqNameMatches(COMPOSABLE_FQ_NAME) - hasPreviewAnnotation = hasPreviewAnnotation || annotation.fqNameMatches(DESKTOP_PREVIEW_ANNOTATION_FQN) + hasPreviewAnnotation = hasPreviewAnnotation || + annotation.fqNameMatches(DESKTOP_PREVIEW_ANNOTATION_FQN) || + annotation.fqNameMatches(COMMON_PREVIEW_ANNOTATION_FQN) } return hasComposableAnnotation && hasPreviewAnnotation