diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-01-14 20:30:54 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-01-14 20:30:54 +0100 |
commit | 807451f9ad9664e7b26cc50c4f08a2a9bf3be538 (patch) | |
tree | 08f6e458ae15aa5796a53d4629b2ff5c16f783c9 /src | |
parent | 77c1f53cab3c2b143a3dafaf6c7bef49df5bcdb9 (diff) | |
parent | f36d9b0e4f336de7e35dcfa33934ab287b76d964 (diff) | |
download | dokka-807451f9ad9664e7b26cc50c4f08a2a9bf3be538.tar.gz dokka-807451f9ad9664e7b26cc50c4f08a2a9bf3be538.tar.bz2 dokka-807451f9ad9664e7b26cc50c4f08a2a9bf3be538.zip |
Merge branch 'defaut-param-values'
Conflicts:
src/Kotlin/DocumentationBuilder.kt
test/src/format/MarkdownFormatTest.kt
Diffstat (limited to 'src')
-rw-r--r-- | src/Kotlin/DocumentationBuilder.kt | 11 | ||||
-rw-r--r-- | src/Kotlin/KotlinLanguageService.kt | 5 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt index 1e09e110..6403f14c 100644 --- a/src/Kotlin/DocumentationBuilder.kt +++ b/src/Kotlin/DocumentationBuilder.kt @@ -17,6 +17,8 @@ import java.io.File import com.intellij.psi.PsiDocumentManager import com.intellij.psi.PsiNameIdentifierOwner import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.resolve.source.getPsi +import org.jetbrains.kotlin.psi.JetParameter public data class DocumentationOptions(val includeNonPublic: Boolean = false, val sourceLinks: List<SourceLinkDefinition>) @@ -351,6 +353,15 @@ class DocumentationBuilder(val session: ResolveSession, val options: Documentati } else { node.appendType(getType()) } + if (hasDefaultValue()) { + val psi = getSource().getPsi() as? JetParameter + if (psi != null) { + val defaultValueText = psi.getDefaultValue()?.getText() + if (defaultValueText != null) { + node.append(DocumentationNode(defaultValueText, Content.Empty, Kind.Value), DocumentationReference.Kind.Detail) + } + } + } node.appendAnnotations(this) register(this, node) return node diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt index c273ff3d..80a76791 100644 --- a/src/Kotlin/KotlinLanguageService.kt +++ b/src/Kotlin/KotlinLanguageService.kt @@ -133,6 +133,11 @@ class KotlinLanguageService : LanguageService { symbol(": ") val parameterType = node.detail(DocumentationNode.Kind.Type) renderType(parameterType) + val valueNode = node.details(DocumentationNode.Kind.Value).firstOrNull() + if (valueNode != null) { + symbol(" = ") + text(valueNode.name) + } } private fun ContentNode.renderTypeParametersForNode(node: DocumentationNode) { |