aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Kotlin/KotlinLanguageService.kt12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt
index 0d1d6b85..038ade9c 100644
--- a/src/Kotlin/KotlinLanguageService.kt
+++ b/src/Kotlin/KotlinLanguageService.kt
@@ -341,19 +341,25 @@ class KotlinLanguageService : LanguageService {
indentedSoftLineBreak()
renderParameter(it, renderMode)
}
- softLineBreak()
- symbol(")")
if (needReturnType(node)) {
+ softLineBreak()
+ symbol(")")
symbol(": ")
renderType(node.detail(DocumentationNode.Kind.Type))
}
+ else {
+ symbol(")")
+ }
}
private fun needReturnType(node: DocumentationNode) = when(node.kind) {
DocumentationNode.Kind.Constructor -> false
- else -> true
+ else -> !node.isUnitReturnType()
}
+ fun DocumentationNode.isUnitReturnType(): Boolean =
+ detail(DocumentationNode.Kind.Type).hiddenLinks.firstOrNull()?.qualifiedName() == "kotlin.Unit"
+
private fun ContentBlock.renderProperty(node: DocumentationNode, renderMode: RenderMode) {
if (renderMode == RenderMode.FULL) {
renderAnnotationsForNode(node)