diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2022-09-21 13:14:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-21 13:14:51 +0200 |
commit | 879d4f2652d528f20c95d5bb17899d6cb10c5e85 (patch) | |
tree | 27b2ee08207aeba43a58bb7dd9a26315f4470d4d /plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt | |
parent | e49726f2b9a61278ba3ced9eb2438d925f5d364c (diff) | |
download | dokka-879d4f2652d528f20c95d5bb17899d6cb10c5e85.tar.gz dokka-879d4f2652d528f20c95d5bb17899d6cb10c5e85.tar.bz2 dokka-879d4f2652d528f20c95d5bb17899d6cb10c5e85.zip |
Wrap long signatures dynamically based on client width (#2659)
Diffstat (limited to 'plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt')
-rw-r--r-- | plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt index 7ed7ff3f..f6c4f0db 100644 --- a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt +++ b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt @@ -202,39 +202,18 @@ interface JvmSignatureUtils { fun PageContentBuilder.DocumentableContentBuilder.parametersBlock( function: DFunction, paramBuilder: PageContentBuilder.DocumentableContentBuilder.(DParameter) -> Unit ) { - val shouldWrap = function.shouldWrapParams() - val parametersStyle = if (shouldWrap) setOf(ContentStyle.Wrapped) else emptySet() - val elementStyle = if (shouldWrap) setOf(ContentStyle.Indented) else emptySet() - group(kind = SymbolContentKind.Parameters, styles = parametersStyle) { + group(kind = SymbolContentKind.Parameters, styles = emptySet()) { function.parameters.dropLast(1).forEach { - group(kind = SymbolContentKind.Parameter, styles = elementStyle) { + group(kind = SymbolContentKind.Parameter) { paramBuilder(it) punctuation(", ") } } - group(kind = SymbolContentKind.Parameter, styles = elementStyle) { + group(kind = SymbolContentKind.Parameter) { paramBuilder(function.parameters.last()) } } } - - /** - * Determines whether parameters in a function (including constructor) should be wrapped - * - * Without wrapping: - * ``` - * class SimpleClass(foo: String, bar: String) {} - * ``` - * With wrapping: - * ``` - * class SimpleClass( - * foo: String, - * bar: String, - * baz: String - * ) - * ``` - */ - private fun DFunction.shouldWrapParams() = this.parameters.size >= 3 } sealed class AtStrategy |