diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2018-04-26 18:04:18 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2018-07-14 23:46:18 +0300 |
commit | f8c358a6a5b269a8dcd5240db8dd14a497c261c2 (patch) | |
tree | 382caff2a420e1ff3c96a6a8e45ff25a0fea2137 /core | |
parent | 54874733ff84998d26e21b57384ad3b2ca151fc2 (diff) | |
download | dokka-f8c358a6a5b269a8dcd5240db8dd14a497c261c2.tar.gz dokka-f8c358a6a5b269a8dcd5240db8dd14a497c261c2.tar.bz2 dokka-f8c358a6a5b269a8dcd5240db8dd14a497c261c2.zip |
KT-24036: Don't show visibility modifiers in summary
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/kotlin/Kotlin/KotlinLanguageService.kt | 9 | ||||
-rw-r--r-- | core/src/main/kotlin/Languages/CommonLanguageService.kt | 1 | ||||
-rw-r--r-- | core/src/main/kotlin/Languages/NewJavaLanguageService.kt | 10 |
3 files changed, 13 insertions, 7 deletions
diff --git a/core/src/main/kotlin/Kotlin/KotlinLanguageService.kt b/core/src/main/kotlin/Kotlin/KotlinLanguageService.kt index 79350237..613b9451 100644 --- a/core/src/main/kotlin/Kotlin/KotlinLanguageService.kt +++ b/core/src/main/kotlin/Kotlin/KotlinLanguageService.kt @@ -23,7 +23,7 @@ class KotlinLanguageService : CommonLanguageService() { NodeKind.Type, NodeKind.UpperBound -> renderType(node, renderMode) - NodeKind.Modifier -> renderModifier(this, node) + NodeKind.Modifier -> renderModifier(this, node, renderMode) NodeKind.Constructor, NodeKind.Function, NodeKind.CompanionObjectFunction -> renderFunction(node, renderMode) @@ -188,13 +188,16 @@ class KotlinLanguageService : CommonLanguageService() { override fun renderModifier( block: ContentBlock, node: DocumentationNode, + renderMode: RenderMode, nowrap: Boolean ) { when (node.name) { "final", "public", "var" -> { } else -> { - super.renderModifier(block, node, nowrap) + if (node.name !in fullOnlyModifiers || renderMode == RenderMode.FULL) { + super.renderModifier(block, node, renderMode, nowrap) + } } } } @@ -289,7 +292,7 @@ class KotlinLanguageService : CommonLanguageService() { if (renderMode == RenderMode.SUMMARY && it.name in fullOnlyModifiers) { continue } - renderModifier(this, it, nowrap) + renderModifier(this, it, renderMode, nowrap) } } diff --git a/core/src/main/kotlin/Languages/CommonLanguageService.kt b/core/src/main/kotlin/Languages/CommonLanguageService.kt index f155192d..edefa1b5 100644 --- a/core/src/main/kotlin/Languages/CommonLanguageService.kt +++ b/core/src/main/kotlin/Languages/CommonLanguageService.kt @@ -19,6 +19,7 @@ abstract class CommonLanguageService : LanguageService { open fun renderModifier( block: ContentBlock, node: DocumentationNode, + renderMode: LanguageService.RenderMode, nowrap: Boolean = false ) = with(block) { keyword(node.name) diff --git a/core/src/main/kotlin/Languages/NewJavaLanguageService.kt b/core/src/main/kotlin/Languages/NewJavaLanguageService.kt index 22ad62b2..0266c033 100644 --- a/core/src/main/kotlin/Languages/NewJavaLanguageService.kt +++ b/core/src/main/kotlin/Languages/NewJavaLanguageService.kt @@ -1,16 +1,18 @@ package org.jetbrains.dokka +import org.jetbrains.dokka.LanguageService.RenderMode + /** * Implements [LanguageService] and provides rendering of symbols in Java language */ class NewJavaLanguageService : CommonLanguageService() { - override fun render(node: DocumentationNode, renderMode: LanguageService.RenderMode): ContentNode { + override fun render(node: DocumentationNode, renderMode: RenderMode): ContentNode { return content { (when (node.kind) { NodeKind.Package -> renderPackage(node) in NodeKind.classLike -> renderClass(node) - NodeKind.Modifier -> renderModifier(this, node) + NodeKind.Modifier -> renderModifier(this, node, renderMode) NodeKind.TypeParameter -> renderTypeParameter(node) NodeKind.Type, NodeKind.UpperBound -> renderType(node) @@ -26,11 +28,11 @@ class NewJavaLanguageService : CommonLanguageService() { override fun summarizeSignatures(nodes: List<DocumentationNode>): ContentNode? = null - override fun renderModifier(block: ContentBlock, node: DocumentationNode, nowrap: Boolean) { + override fun renderModifier(block: ContentBlock, node: DocumentationNode, renderMode: RenderMode, nowrap: Boolean) { when (node.name) { "open", "internal" -> { } - else -> super.renderModifier(block, node, nowrap) + else -> super.renderModifier(block, node, renderMode, nowrap) } } |