-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added ability to skip @Preview functions #401
Conversation
@@ -78,7 +78,7 @@ class ShowkaseProcessor @JvmOverloads constructor( | |||
?.toSet()?.let { set.addAll(it) } | |||
return set | |||
} | |||
override fun getSupportedOptions() = mutableSetOf("skipPrivatePreviews", "multiPreviewType") | |||
override fun getSupportedOptions() = mutableSetOf("skipPrivatePreviews", "skipFunctionsWithPreviewAnnotation", "multiPreviewType") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Open to having a name other than skipFunctionsWithPreviewAnnotation
🫤 Couldn't think of anything better and not a huge fan of what I ended up using
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for adding this!
override fun getSupportedOptions() = mutableSetOf("skipPrivatePreviews", "multiPreviewType") | ||
override fun getSupportedOptions() = mutableSetOf( | ||
"skipPrivatePreviews", | ||
"skipFunctionsWithPreviewAnnotation", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might consider a more explicit name, as this won't skip all functions with preview annotations (ie, it keeps the ones with showkase annotation)
"skipFunctionsWithPreviewAnnotation", | |
"skipPreviewFunctionsWithoutShowkaseAnnotation", |
or
"skipFunctionsWithPreviewAnnotation", | |
"requireShowkaseAnnotation", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes sense, thanks for the tip!
This PR adds the ability to skip
@Preview
composable from being picked up by Showkase. I had previously added the ability to skip an individual composable using theskip
property that's added to theShowkaseComposable
annotation.However, this config option allows one to skip all
@Preview
annotation with a single line. While Showkase picking up functions annotated with@Preview
is an important feature that makes the library more useful, there might be cases where you might want to enforce usage of theShowkaseComposable
annotation instead as that's a more explicit way to integrate with Showkase. In order to use this feature, you can use the following snippet in your gradle file.If you use KSP:
If you use KAPT:
This PR also contains upgrades to Detekt + Gradle and the fixes that detekt required as a result. Would've been ideal to split this in separate PR's but since I didn't anticipate needing these many changes and I was further along, I decided to just continue adding it to this PR.
@elihart @allenchen1154