diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Kotlin/DocumentationBuilder.kt | 5 | ||||
-rw-r--r-- | src/Kotlin/KotlinLanguageService.kt | 4 | ||||
-rw-r--r-- | src/Model/DocumentationNode.kt | 1 |
3 files changed, 9 insertions, 1 deletions
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt index d8933087..3b7f25d6 100644 --- a/src/Kotlin/DocumentationBuilder.kt +++ b/src/Kotlin/DocumentationBuilder.kt @@ -224,13 +224,16 @@ class DocumentationBuilder(val session: ResolveSession, return val classifierDescriptor = jetType.getConstructor().getDeclarationDescriptor() val name = when (classifierDescriptor) { - is Named -> classifierDescriptor.getName().asString() + if (jetType.isMarkedNullable()) "?" else "" + is Named -> classifierDescriptor.getName().asString() else -> "<anonymous>" } val node = DocumentationNode(name, Content.Empty, kind) if (prefix != "") { node.appendTextNode(prefix, Kind.Modifier) } + if (jetType.isMarkedNullable()) { + node.appendTextNode("?", Kind.NullabilityModifier) + } if (classifierDescriptor != null && !classifierDescriptor.isBoringBuiltinClass()) { link(node, classifierDescriptor) } diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt index 4b43fb88..855745e0 100644 --- a/src/Kotlin/KotlinLanguageService.kt +++ b/src/Kotlin/KotlinLanguageService.kt @@ -114,6 +114,10 @@ class KotlinLanguageService : LanguageService { } symbol(">") } + val nullabilityModifier = node.details(DocumentationNode.Kind.NullabilityModifier).singleOrNull() + if (nullabilityModifier != null) { + symbol(nullabilityModifier.name) + } } private fun ContentBlock.renderModifier(node: DocumentationNode) { diff --git a/src/Model/DocumentationNode.kt b/src/Model/DocumentationNode.kt index 3fc1198c..c9373849 100644 --- a/src/Model/DocumentationNode.kt +++ b/src/Model/DocumentationNode.kt @@ -91,6 +91,7 @@ public open class DocumentationNode(val name: String, Exception Modifier + NullabilityModifier Module |