From 1e862f2fc05c9d01d4d9c00de5d1a4235ff85a9d Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 9 Sep 2015 14:54:19 +0200 Subject: render annotations with @; render only @MustBeDocumented annotations; render all modifiers --- src/Kotlin/KotlinLanguageService.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/Kotlin/KotlinLanguageService.kt') diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt index a22ba8af..d61db546 100644 --- a/src/Kotlin/KotlinLanguageService.kt +++ b/src/Kotlin/KotlinLanguageService.kt @@ -154,8 +154,9 @@ class KotlinLanguageService : LanguageService { } } - private fun ContentBlock.renderParameter(node: DocumentationNode) { + private fun ContentBlock.renderParameter(node: DocumentationNode, renderMode: RenderMode) { renderAnnotationsForNode(node) + renderModifiersForNode(node, renderMode) identifier(node.name, IdentifierKind.ParameterName) symbol(":") nbsp() @@ -212,7 +213,7 @@ class KotlinLanguageService : LanguageService { } private fun ContentBlock.renderAnnotation(node: DocumentationNode) { - identifier(node.name, IdentifierKind.AnnotationName) + identifier("@" + node.name, IdentifierKind.AnnotationName) val parameters = node.details(DocumentationNode.Kind.Parameter) if (!parameters.isEmpty()) { symbol("(") @@ -229,9 +230,9 @@ class KotlinLanguageService : LanguageService { renderAnnotationsForNode(node) when (node.kind) { DocumentationNode.Kind.Class, - DocumentationNode.Kind.AnnotationClass -> keyword("class ") + DocumentationNode.Kind.AnnotationClass, + DocumentationNode.Kind.Enum -> keyword("class ") DocumentationNode.Kind.Interface -> keyword("interface ") - DocumentationNode.Kind.Enum -> keyword("enum class ") DocumentationNode.Kind.EnumItem -> keyword("enum val ") DocumentationNode.Kind.Object -> keyword("object ") else -> throw IllegalArgumentException("Node $node is not a class-like object") @@ -266,7 +267,7 @@ class KotlinLanguageService : LanguageService { symbol("(") renderList(node.details(DocumentationNode.Kind.Parameter)) { - renderParameter(it) + renderParameter(it, renderMode) } symbol(")") if (needReturnType(node)) { -- cgit