Comments (5)
Ran into this as well, leaving some notes on how this can be improved:
-
It appears the generated file names for properties can be aggressively long, including the preview name, the component name, and the group name concatenated together. beta17 was even worse including the package name as well but that appears to be fixed.
Do we actually need all of those? I'd think the preview function name would be sufficient since you can't have duplicate function names in the source files anyway, but maybe there's something I'm missing there.
-
If you use preview params it also generates a lamba which is represented by a synthetic class. The name of this lambda is filename$propertyname$1.class which blows it up even more. shortening the filename/property would also help here but you can also go one step further and split it out into a separate function so the lamba isn't generated at all. Something like:
public val MyPreviewNameGroup: List<ShowkaseBrowserComponent> =
PreviewStyle()
.values
.iterator()
.asSequence()
.mapIndexed(::spacingPreviewSpacingExtrasSDKSpacingValues)
.toList()
private fun myPreviewNameGroup(index: Int, previewParam: Param): ShowkaseBrowserComponent {
return ShowkaseBrowserComponent(
group = "Group"
componentName = "Name",
componentKDoc = "",
componentKey = ...,
isDefaultStyle = false,
component = @Composable { MyPreview(param = previewParam) }
)
}
from showkase.
@evant The reason all this info is added is because you can you repeated annotations and a single function can actually end up being multiple previews depending on how you are using the preview annotations. I do think that I need to figure out an alternate way to solve this though as hitting this issue could be common if you are using longer and more descriptive names.
For example, here's a file that Paparazzi generated in the sample project --
com.airbnb.android.showkase.screenshot.testing.paparazzi.sample_MyPaparazziShowkaseScreenshotTest_PaparazziShowkaseTest_test_previews[1.Chips**Basic Chip**Default Style,1.Pixel5,1.Ltr,1.DEFAULT]_chips**basic_chip**default_style
I wonder if I can somehow get rid of the earlier portion of the name that's added by Paparazzi by default i.e com.airbnb.android.showkase.screenshot.testing.paparazzi.sample_MyPaparazziShowkaseScreenshotTest_PaparazziShowkaseTest
. Do you know if I can somehow configure that?
from showkase.
The reason all this info is added is because you can you repeated annotations and a single function can actually end up being multiple previews depending on how you are using the preview annotations
Could you generate multiple properties in the same file or generate a single property that's a list of the components?
from showkase.
Actually, just realized that this issue is about the generated paparazzi name. This name is purely generated from the test name so the fix would be separate, happy to open a new issue for generated showkase class names if that makes more sense.
from showkase.
I'm getting this as well with just Showkase (although actually we plan to use Paparazzi soon as well). Is there a possible workaround? We have a lot of previews and need descriptive names.
from showkase.
Related Issues (20)
- PreviewParameters don't work with Kotlin 1.9 HOT 1
- Incorrect generate ShowcaseBrowser color with kotlin 1.9 HOT 2
- Updating compileSdkVersion to 34 causes deceprecation errors for newInstance() HOT 2
- exported ShowkaseBrowserActivity HOT 3
- Incompatibility with Dagger 2.48 HOT 7
- Is that possible to download an image from url? HOT 2
- Showkase silently ignores duplicate ShowkaseComposables
- IllegalStateException on ShowkaseMultiPreviewCodegenMetadata HOT 6
- When using Showkase version 1.01 or 1.0.2 I get this error "error: cannot find symbol - import androidx.room.util.RelationUtil; " HOT 1
- old account label bypassing all fraud measures HOT 1
- Multi module: same package name leads to silently ignoring previews
- Class file has wrong version 61.0, should be 55.0 HOT 1
- Showkase ignoring the Locale parameter for @Preview
- Feature Request: Compose Multiplatform Support HOT 4
- Fatal Exception: java.lang.RuntimeException: Unable to start activity ShowkaseBrowserActivity HOT 12
- Any plans to add support for other compose multiplatform targets like ios and desktop? HOT 2
- Feature request: Add support for K2 compiler.
- Root module codegen preventing incremental compilation for KSP HOT 3
- Remote Image Not Displaying in Showcase Using Coil's AsyncImage HOT 2
- Impossible to use `@ShowkaseColor` or `@ShowkaseTypography` on objects' fields that have a constructor with no parameters HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from showkase.