aboutsummaryrefslogtreecommitdiff
path: root/src/Kotlin/KotlinLanguageService.kt
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2014-12-30 16:59:34 +0100
committerDmitry Jemerov <yole@jetbrains.com>2014-12-30 16:59:34 +0100
commit0e70fa4ca021bff09e7d9ce64269a4e698512af5 (patch)
tree48baff7faa1955ff60fed060a531982da33f36f6 /src/Kotlin/KotlinLanguageService.kt
parentef51f7e2466e28db0943d528b6b489aefd098c0d (diff)
downloaddokka-0e70fa4ca021bff09e7d9ce64269a4e698512af5.tar.gz
dokka-0e70fa4ca021bff09e7d9ce64269a4e698512af5.tar.bz2
dokka-0e70fa4ca021bff09e7d9ce64269a4e698512af5.zip
render annotations
Diffstat (limited to 'src/Kotlin/KotlinLanguageService.kt')
-rw-r--r--src/Kotlin/KotlinLanguageService.kt24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt
index a4016849..1e5edf4d 100644
--- a/src/Kotlin/KotlinLanguageService.kt
+++ b/src/Kotlin/KotlinLanguageService.kt
@@ -1,15 +1,6 @@
package org.jetbrains.dokka
-import org.jetbrains.dokka.symbol
-import org.jetbrains.dokka.text
-import org.jetbrains.dokka.identifier
-import org.jetbrains.dokka.link
-import org.jetbrains.dokka.keyword
-import org.jetbrains.dokka.LanguageService
-import org.jetbrains.dokka.DocumentationNode
-import org.jetbrains.dokka.ContentNode
import org.jetbrains.dokka
-import org.jetbrains.dokka.ContentText
/**
* Implements [LanguageService] and provides rendering of symbols in Kotlin language
@@ -135,6 +126,7 @@ class KotlinLanguageService : LanguageService {
}
private fun ContentNode.renderParameter(node: DocumentationNode) {
+ renderAnnotationsForNode(node)
identifier(node.name)
symbol(": ")
val parameterType = node.detail(DocumentationNode.Kind.Type)
@@ -171,8 +163,20 @@ class KotlinLanguageService : LanguageService {
}
}
+ private fun ContentNode.renderAnnotationsForNode(node: DocumentationNode) {
+ node.annotations.forEach {
+ renderAnnotation(it)
+ }
+ }
+
+ private fun ContentNode.renderAnnotation(node: DocumentationNode) {
+ identifier(node.name)
+ text(" ")
+ }
+
private fun ContentNode.renderClass(node: DocumentationNode) {
renderModifiersForNode(node)
+ renderAnnotationsForNode(node)
when (node.kind) {
DocumentationNode.Kind.Class -> keyword("class ")
DocumentationNode.Kind.Interface -> keyword("trait ")
@@ -189,6 +193,7 @@ class KotlinLanguageService : LanguageService {
private fun ContentNode.renderFunction(node: DocumentationNode) {
renderModifiersForNode(node)
+ renderAnnotationsForNode(node)
when (node.kind) {
DocumentationNode.Kind.Constructor -> identifier(node.owner!!.name)
DocumentationNode.Kind.Function,
@@ -218,6 +223,7 @@ class KotlinLanguageService : LanguageService {
private fun ContentNode.renderProperty(node: DocumentationNode) {
renderModifiersForNode(node)
+ renderAnnotationsForNode(node)
when (node.kind) {
DocumentationNode.Kind.Property,
DocumentationNode.Kind.ClassObjectProperty -> keyword("val ")