diff options
author | Ignat Beresnev <ignat@beresnev.me> | 2022-01-27 12:56:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-27 12:56:27 +0300 |
commit | e0a10c24ea7e623137f2ab21522ed0f84bf59814 (patch) | |
tree | c863973a41efccb4ad34858c88b885e5370b2dbd /core/src | |
parent | 7c44db1ef0075e2b80a4723e0747bbf57c32e775 (diff) | |
download | dokka-e0a10c24ea7e623137f2ab21522ed0f84bf59814.tar.gz dokka-e0a10c24ea7e623137f2ab21522ed0f84bf59814.tar.bz2 dokka-e0a10c24ea7e623137f2ab21522ed0f84bf59814.zip |
KT-50292 - Implement vertical alignment of parameters (#2309)
* Implement vertical alignment (wrapping) of parameters for kt
* Add tests for params wrapping and extend matchers to check for classes
* Add distinguishable parameters block to kotlinAsJava, extract common logic
* Create a separate Kind for symbol function parameters
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/kotlin/pages/ContentNodes.kt | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/core/src/main/kotlin/pages/ContentNodes.kt b/core/src/main/kotlin/pages/ContentNodes.kt index c1bb3b8c..293fe6c4 100644 --- a/core/src/main/kotlin/pages/ContentNodes.kt +++ b/core/src/main/kotlin/pages/ContentNodes.kt @@ -316,9 +316,25 @@ data class PlatformHintedContent( interface Style interface Kind +/** + * [ContentKind] represents a grouping of content of one kind. This can be rendered + * as either a part of a composite page (one tab/block within a class's page, for instance) + * or as a separate page altogether. + */ enum class ContentKind : Kind { - Comment, Constructors, Functions, Parameters, Properties, Classlikes, Packages, Symbol, Sample, Main, BriefComment, + /** + * Marks all sorts of signatures. Can contain sub-kinds marked as [SymbolContentKind] + * + * Some examples: + * - primary constructor: `data class CoroutineName(name: String) : AbstractCoroutineContextElement` + * - constructor: `fun CoroutineName(name: String)` + * - function: `open override fun toString(): String` + * - property: `val name: String` + */ + Symbol, + + Comment, Constructors, Functions, Parameters, Properties, Classlikes, Packages, Sample, Main, BriefComment, Empty, Source, TypeAliases, Cover, Inheritors, SourceSetDependentHint, Extensions, Annotations; companion object { @@ -338,6 +354,30 @@ enum class ContentKind : Kind { fun shouldBePlatformTagged(kind: Kind): Boolean = kind in platformTagged } } + +/** + * Content kind for [ContentKind.Symbol] content, which is essentially about signatures + */ +enum class SymbolContentKind : Kind { + /** + * Marks constructor/function parameters, everything in-between parentheses. + * + * For function `fun foo(bar: String, baz: Int, qux: Boolean)`, + * the parameters would be the whole of `bar: String, baz: Int, qux: Boolean` + */ + Parameters, + + /** + * Marks a single parameter in a function. Most likely to be a child of [Parameters]. + * + * In function `fun foo(bar: String, baz: Int, qux: Boolean)` there would be 3 [Parameter] instances: + * - `bar: String, ` + * - `baz: Int, ` + * - `qux: Boolean` + */ + Parameter, +} + enum class TokenStyle : Style { Keyword, Punctuation, Function, Operator, Annotation, Number, String, Boolean, Constant, Builtin } @@ -347,7 +387,8 @@ enum class TextStyle : Style { } enum class ContentStyle : Style { - RowTitle, TabbedContent, WithExtraAttributes, RunnableSample, InDocumentationAnchor, Caption + RowTitle, TabbedContent, WithExtraAttributes, RunnableSample, InDocumentationAnchor, Caption, + Wrapped, Indented } enum class ListStyle : Style { |