airbnb / Showkase

🔦 Showkase is an annotation-processor based Android library that helps you organize, discover, search and visualize Jetpack Compose UI elements
https://medium.com/airbnb-engineering/introducing-showkase-a-library-to-organize-discover-and-visualize-your-jetpack-compose-elements-d5c34ef01095
Apache License 2.0
2.1k stars 107 forks source link

Allow @ShowkaseComposable as annotation for annotation class #331

Open ln-12 opened 1 year ago

ln-12 commented 1 year ago

Hey, I have a feature request which is kind of related to https://github.com/airbnb/Showkase/issues/233.

The @Preview annotation can be used for functions and other annotation classed (see here). @ShowkaseComposable can only be used for functions. I would like to do the following:

// some other annotations
@ShowkaseComposable
annotation class DefaultPreview

This is already possible with @Preview. Do you see any issues when allowing @ShowkaseComposable on annotation classes to achieve that? I think the only thing needed for that would be to add AnnotationTarget.ANNOTATION_CLASS here.

vinaygaba commented 11 months ago

@oas004 Any chance you could add the same functionality to ShowkaseComposable as well? Trying to remember why you didn't add this in the original PR's itself?

oas004 commented 11 months ago

Hey, I think I just might have forgotten to add that as well in the initial PRs. I think that should be possible, but I'm not sure that it is as easy as just adding AnnotationTarget.ANNOTATION_CLASS. I can try to look into it this weekend if that is okay? :)

Do you think it would make sense to add the repeatable pattern as well to this annotation? So that this is possible?


@ShokaseComposable
@ShowkaseComposable
annotation class DefaultPreview

and


@ShokaseComposable
@ShowkaseComposable
@Composable
fun SomePreview()
ReginFell commented 5 months ago

Do you have any updates on this by any chance? This would be extremely useful for us since we want to use the ShowkaseComposable annotation across different modules, but we want to hide its configuration.

@ShowkaseComposable(tags = listOf(specialTag)
annotation class HasSpecialTag

@HasSpecialTag
@Composable
fun SomePreview()