aboutsummaryrefslogtreecommitdiff
path: root/src/Kotlin
diff options
context:
space:
mode:
authorDmitry Jemerov <intelliyole@gmail.com>2015-01-13 16:26:11 +0100
committerDmitry Jemerov <intelliyole@gmail.com>2015-01-13 16:26:11 +0100
commit891cc8569d535c3ac5ade23d7fd56dbca619e05b (patch)
tree4a9d5eec58105cd5cf28e88613156c55f1adbb3f /src/Kotlin
parent19ec79c91350e91449d01d4e1823313af1dd81bc (diff)
parent1ce5373a1f6c99d01db2156a833fcd796ef53e27 (diff)
downloaddokka-891cc8569d535c3ac5ade23d7fd56dbca619e05b.tar.gz
dokka-891cc8569d535c3ac5ade23d7fd56dbca619e05b.tar.bz2
dokka-891cc8569d535c3ac5ade23d7fd56dbca619e05b.zip
Merge pull request #11 from orangy/enum-members
better display for enum members
Diffstat (limited to 'src/Kotlin')
-rw-r--r--src/Kotlin/DocumentationBuilder.kt8
-rw-r--r--src/Kotlin/KotlinLanguageService.kt7
2 files changed, 11 insertions, 4 deletions
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index 8b6b19d3..a9b017bb 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -210,9 +210,13 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati
}
val node = DocumentationNode(this, kind)
node.appendSupertypes(this)
- if (getKind() != ClassKind.OBJECT) {
+ if (getKind() != ClassKind.OBJECT && getKind() != ClassKind.ENUM_ENTRY) {
node.appendChildren(getTypeConstructor().getParameters(), DocumentationReference.Kind.Detail)
- node.appendChildren(getConstructors(), DocumentationReference.Kind.Member)
+ val constructorsToDocument = if (getKind() == ClassKind.ENUM_CLASS)
+ getConstructors().filter { it.getValueParameters().size() > 0 }
+ else
+ getConstructors()
+ node.appendChildren(constructorsToDocument, DocumentationReference.Kind.Member)
}
node.appendChildren(getDefaultType().getMemberScope().getAllDescriptors(), DocumentationReference.Kind.Member)
val classObjectDescriptor = getClassObjectDescriptor()
diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt
index 40f47639..8795aba6 100644
--- a/src/Kotlin/KotlinLanguageService.kt
+++ b/src/Kotlin/KotlinLanguageService.kt
@@ -1,20 +1,23 @@
package org.jetbrains.dokka
+import org.jetbrains.dokka.LanguageService.RenderMode
+
/**
* Implements [LanguageService] and provides rendering of symbols in Kotlin language
*/
class KotlinLanguageService : LanguageService {
- override fun render(node: DocumentationNode): ContentNode {
+ override fun render(node: DocumentationNode, renderMode: RenderMode): ContentNode {
return content {
when (node.kind) {
DocumentationNode.Kind.Package -> renderPackage(node)
DocumentationNode.Kind.Class,
DocumentationNode.Kind.Interface,
DocumentationNode.Kind.Enum,
- DocumentationNode.Kind.EnumItem,
DocumentationNode.Kind.AnnotationClass,
DocumentationNode.Kind.Object -> renderClass(node)
+ DocumentationNode.Kind.EnumItem -> if (renderMode == RenderMode.FULL) identifier(node.name)
+
DocumentationNode.Kind.TypeParameter -> renderTypeParameter(node)
DocumentationNode.Kind.Type,
DocumentationNode.Kind.UpperBound -> renderType(node)