diff options
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) { |