From 4907736abf96bf04b8e23a6772f0411936cb2008 Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Tue, 14 Oct 2014 19:53:13 +0400 Subject: Sort members into groups, filter accessors --- src/Formats/StructuredFormatService.kt | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'src/Formats/StructuredFormatService.kt') diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt index 280aa6b5..740f6b6a 100644 --- a/src/Formats/StructuredFormatService.kt +++ b/src/Formats/StructuredFormatService.kt @@ -81,7 +81,7 @@ public abstract class StructuredFormatService(val locationService: LocationServi if (!single) { appendBlockCode(to, formatText(location, languageService.render(node))) } - appendLine(to, formatText(location,node.content.description)) + appendLine(to, formatText(location, node.content.description)) appendLine(to) for ((label, section) in node.content.sections) { if (label.startsWith("$")) @@ -118,7 +118,7 @@ public abstract class StructuredFormatService(val locationService: LocationServi } } - private fun StructuredFormatService.appendSection(location : Location, caption: String, nodes: List, node: DocumentationNode, to: StringBuilder) { + private fun StructuredFormatService.appendSection(location: Location, caption: String, nodes: List, node: DocumentationNode, to: StringBuilder) { if (nodes.any()) { appendHeader(to, caption, 3) @@ -163,7 +163,30 @@ public abstract class StructuredFormatService(val locationService: LocationServi } for (node in nodes) { - appendSection(location, "Members", node.members, node, to) + appendSection(location, "Packages", node.members(DocumentationNode.Kind.Package), node, to) + appendSection(location, "Types", node.members.filter { + it.kind in setOf( + DocumentationNode.Kind.Class, + DocumentationNode.Kind.Interface, + DocumentationNode.Kind.Enum, + DocumentationNode.Kind.Object) + }, node, to) + appendSection(location, "Constructors", node.members(DocumentationNode.Kind.Constructor), node, to) + appendSection(location, "Properties", node.members(DocumentationNode.Kind.Property), node, to) + appendSection(location, "Functions", node.members(DocumentationNode.Kind.Function), node, to) + appendSection(location, "Accessors", node.members(DocumentationNode.Kind.PropertyAccessor), node, to) + appendSection(location, "Other members", node.members.filter { + it.kind !in setOf( + DocumentationNode.Kind.Class, + DocumentationNode.Kind.Interface, + DocumentationNode.Kind.Object, + DocumentationNode.Kind.Constructor, + DocumentationNode.Kind.Property, + DocumentationNode.Kind.Package, + DocumentationNode.Kind.Function, + DocumentationNode.Kind.PropertyAccessor + ) + }, node, to) appendSection(location, "Extensions", node.extensions, node, to) appendSection(location, "Inheritors", node.inheritors, node, to) appendSection(location, "Links", node.links, node, to) -- cgit