Skip to content
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

fix duplicate screenshot #494

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

yuchan2215
Copy link
Contributor

For example, let's say there are the following functions in the file: ExampleChip and ExampleChipPreview. In the current implementation, ExampleChip is also included in ExampleChipPreview, resulting in the same preview being displayed twice. To avoid this, I added a process to delete duplicate files.

private suspend fun findImages(
elements: List<KtElement>,
files: List<File>
): List<File> {
val elementNames = elements.mapNotNull { element ->
element.name
}
return withContext(Dispatchers.Default) {
elementNames.flatMap { elementName ->
val pattern = ".*$elementName.*.png"
files
.filter {
val matches = it.name.matches(Regex(pattern))
matches
}
}
}
}

I am not very good at English, so I am using ChatGPT.

Copy link
Owner

@takahirom takahirom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you for your contribution!

@takahirom takahirom merged commit 0dbd515 into takahirom:main Sep 26, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants