aboutsummaryrefslogtreecommitdiff
path: root/src/Kotlin/KotlinLanguageService.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/Kotlin/KotlinLanguageService.kt')
-rw-r--r--src/Kotlin/KotlinLanguageService.kt12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt
index f598a38e..b7723285 100644
--- a/src/Kotlin/KotlinLanguageService.kt
+++ b/src/Kotlin/KotlinLanguageService.kt
@@ -109,7 +109,7 @@ class KotlinLanguageService : LanguageService {
private fun ContentNode.renderModifier(node: DocumentationNode) {
when (node.name) {
- "final", "internal" -> {}
+ "final", "internal", "var" -> {}
else -> {
keyword(node.name)
text(" ")
@@ -134,6 +134,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) {
@@ -245,7 +250,7 @@ class KotlinLanguageService : LanguageService {
renderAnnotationsForNode(node)
when (node.kind) {
DocumentationNode.Kind.Property,
- DocumentationNode.Kind.ClassObjectProperty -> keyword("val ")
+ DocumentationNode.Kind.ClassObjectProperty -> keyword("${node.getPropertyKeyword()} ")
else -> throw IllegalArgumentException("Node $node is not a property")
}
renderTypeParametersForNode(node)
@@ -260,6 +265,9 @@ class KotlinLanguageService : LanguageService {
renderType(node.detail(DocumentationNode.Kind.Type))
}
+ fun DocumentationNode.getPropertyKeyword() =
+ if (details(DocumentationNode.Kind.Modifier).any { it.name == "var" }) "var" else "val"
+
fun ContentNode.identifierOrDeprecated(node: DocumentationNode) {
if (node.deprecation != null) {
val strike = ContentStrikethrough()