diff options
author | Kamil Doległo <kamilok1965@users.noreply.github.com> | 2019-03-11 17:11:50 +0100 |
---|---|---|
committer | Simon Ogorodnik <simon.ogorodnik@gmail.com> | 2019-03-11 19:11:50 +0300 |
commit | 61b126692bb2ede06911ae1c493e8417f0bbe49d (patch) | |
tree | 29068cb287d24cbf130d1d8a070fd6b60387222d /core/src/main/kotlin/Java | |
parent | 7d7e2012e35722c6c0315b2205d708ef5d4341d9 (diff) | |
download | dokka-61b126692bb2ede06911ae1c493e8417f0bbe49d.tar.gz dokka-61b126692bb2ede06911ae1c493e8417f0bbe49d.tar.bz2 dokka-61b126692bb2ede06911ae1c493e8417f0bbe49d.zip |
Allow linking arguments with methods, change link label (#431)
* Add PsiParameter to link arguments with methods, change link label
Diffstat (limited to 'core/src/main/kotlin/Java')
-rw-r--r-- | core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt index f0b3a56b..1ef601d3 100644 --- a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt +++ b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt @@ -20,11 +20,19 @@ fun getSignature(element: PsiElement?) = when(element) { is PsiClass -> element.qualifiedName is PsiField -> element.containingClass!!.qualifiedName + "$" + element.name is PsiMethod -> - element.containingClass!!.qualifiedName + "$" + element.name + "(" + - element.parameterList.parameters.map { it.type.typeSignature() }.joinToString(",") + ")" + methodSignature(element) + is PsiParameter -> { + val method = (element.parent.parent as PsiMethod) + methodSignature(method) + } else -> null } +private fun methodSignature(method: PsiMethod): String { + return method.containingClass!!.qualifiedName + "$" + method.name + "(" + + method.parameterList.parameters.map { it.type.typeSignature() }.joinToString(",") + ")" +} + private fun PsiType.typeSignature(): String = when(this) { is PsiArrayType -> "Array((${componentType.typeSignature()}))" is PsiPrimitiveType -> "kotlin." + canonicalText.capitalize() |