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: Fixes description indenting #691

Merged

Conversation

ctasada
Copy link
Collaborator

@ctasada ctasada commented Apr 7, 2024

When the description field includes a long description it may not be properly rendered, mainly in Kotlin, where the way of managing the text-blocks is different.

This PR improves the way descriptions are managed by:

  • Removes empty lines at the beginning of the text-block
  • Removes indention due to alignment, but keeps indention in the lines that need it

When the description field includes a long description it may not be properly rendered, mainly in Kotlin, where the way of managing the text-blocks is different.

 This PR improves the way descriptions are managed by:

 - Removes empty lines at the beginning of the text-block
 - Removes indention due to alignment, but keeps indention in the lines that need it
Copy link

netlify bot commented Apr 7, 2024

Deploy Preview for springwolf-ui canceled.

Name Link
🔨 Latest commit c755ff1
🔍 Latest deploy log https://app.netlify.com/sites/springwolf-ui/deploys/661d5fefbb97d60008d5610e

@ctasada
Copy link
Collaborator Author

ctasada commented Apr 7, 2024

I think this issue may be exclusive from Kotlin, when using text-blocks. The change should be transparent (or nearly transparent) for Java code, but we can wrap it in a special setting if needed.

@timonback
Copy link
Member

I am assuming you use multi–line strings aka text blocks.
If it is kotlin specific, would it be sufficient for the users to call trimIndent themselves?

https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/trim-indent.html

(I haven't looked through the code. This sounds like a method that should be part of a standard lib)

@ctasada
Copy link
Collaborator Author

ctasada commented Apr 8, 2024

Sadly it's not possible. Annotations must be compile-time constants, so it's not possible to do any manipulation, like .trimIndent()

@timonback
Copy link
Member

Argh. Unfortunate that https://youtrack.jetbrains.com/issue/KT-22505/Support-calls-to-trimMargin-trimIndent-as-initializer-for-const-vals is not getting resolved.
And there seems to be no easy Apache Commons or similar implementation.

Will review the PR on Friday

@sam0r040
Copy link
Collaborator

Kind of unfortunate that there is no nice solution and we have to provide the Utils for it. I think I found some simplifications, but not as much as I wished :(. However, I would add two more test cases: String with no empty lines and null input.

@ctasada
Copy link
Collaborator Author

ctasada commented Apr 15, 2024

@sam0r040 All the comments addressed. I also added more tests covering the different corner cases. Coverage is now 100%

@sam0r040 sam0r040 merged commit d7e3175 into springwolf:master Apr 19, 2024
20 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.

3 participants