aboutsummaryrefslogtreecommitdiff
path: root/src/Kotlin/KotlinLanguageService.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/Kotlin/KotlinLanguageService.kt')
-rw-r--r--src/Kotlin/KotlinLanguageService.kt12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt
index 80a76791..b7723285 100644
--- a/src/Kotlin/KotlinLanguageService.kt
+++ b/src/Kotlin/KotlinLanguageService.kt
@@ -25,7 +25,8 @@ class KotlinLanguageService : LanguageService {
DocumentationNode.Kind.Modifier -> renderModifier(node)
DocumentationNode.Kind.Constructor,
DocumentationNode.Kind.Function,
- DocumentationNode.Kind.ClassObjectFunction -> renderFunction(node)
+ DocumentationNode.Kind.ClassObjectFunction,
+ DocumentationNode.Kind.PropertyAccessor -> renderFunction(node)
DocumentationNode.Kind.Property,
DocumentationNode.Kind.ClassObjectProperty -> renderProperty(node)
else -> ContentText("${node.kind}: ${node.name}")
@@ -214,6 +215,7 @@ class KotlinLanguageService : LanguageService {
DocumentationNode.Kind.Constructor -> identifier(node.owner!!.name)
DocumentationNode.Kind.Function,
DocumentationNode.Kind.ClassObjectFunction -> keyword("fun ")
+ DocumentationNode.Kind.PropertyAccessor -> {}
else -> throw IllegalArgumentException("Node $node is not a function-like object")
}
renderTypeParametersForNode(node)
@@ -231,12 +233,18 @@ class KotlinLanguageService : LanguageService {
renderParameter(it)
}
symbol(")")
- if (node.kind != org.jetbrains.dokka.DocumentationNode.Kind.Constructor) {
+ if (needReturnType(node)) {
symbol(": ")
renderType(node.detail(DocumentationNode.Kind.Type))
}
}
+ private fun needReturnType(node: DocumentationNode) = when(node.kind) {
+ DocumentationNode.Kind.Constructor -> false
+ DocumentationNode.Kind.PropertyAccessor -> node.name == "get"
+ else -> true
+ }
+
private fun ContentNode.renderProperty(node: DocumentationNode) {
renderModifiersForNode(node)
renderAnnotationsForNode(node)