From 5229f97eb9bbd434fb659c29a1d287788a1485f6 Mon Sep 17 00:00:00 2001 From: Felix Mulder Date: Thu, 25 Feb 2016 21:37:47 +0100 Subject: Unclutter scaladoc entity members This commit attempts to fix some minor annoyances regarding the UI when it comes to how things are shown. I.e. the complete definition is now hidden. Long signatures like: ```scala class HashMap[A, +B] extends AbstractMap[A, B] with Map[A, B] with MapLike[A, B, HashMap[A, B]] with Serializable with CustomParallelizable[(A, B), ParHashMap[A, B]] ``` will be reduced to: `class HashMap[A, +B]`. Full signature will be shown on hover and unfold. The package-view has been tweaked to look better on non-HiDPI displays. Also, subpackages to current package are now displayed before other entities. --- .../scala/tools/nsc/doc/html/page/Entity.scala | 27 +++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'src/scaladoc/scala/tools/nsc/doc/html/page/Entity.scala') diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/Entity.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/Entity.scala index 861dccc5dd..c8a7d6d245 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/page/Entity.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/page/Entity.scala @@ -120,18 +120,21 @@ trait EntityPage extends HtmlPage { val (subsToTpl, subsAfterTpl) = parentSub.partition(_.name <= tpl.name) - val subsToTplLis = subsToTpl.map(memberToHtml(_, tpl, indentation = rootToParentLis.length)) + val subsToTplLis = subsToTpl.map(memberToHtml(_, tpl, indentation = rootToParentLis.length)) val subsAfterTplLis = subsAfterTpl.map(memberToHtml(_, tpl, indentation = rootToParentLis.length)) - val currEntityLis = currentPackageTpls + val currEntityLis = currentPackageTpls .filter(x => !x.isPackage && (x.isTrait || x.isClass || x.isAbstractType)) .sortBy(_.name) - .map(entityToUl(_, rootToParentLis.length + 1)) + .map(entityToUl(_, (if (tpl.isPackage) 0 else -1) + rootToParentLis.length)) val currSubLis = tpl.templates .filter(_.isPackage) .sortBy(_.name) .map(memberToHtml(_, tpl, indentation = rootToParentLis.length + 1)) - rootToParentLis ++ subsToTplLis ++ currEntityLis ++ currSubLis ++ subsAfterTplLis + if (subsToTpl.isEmpty && !tpl.isPackage) // current Entity is not a package, show packages before entity listing + rootToParentLis ++ subsToTplLis ++ subsAfterTplLis ++ currSubLis ++ currEntityLis + else + rootToParentLis ++ subsToTplLis ++ currSubLis ++ currEntityLis ++ subsAfterTplLis } @@ -221,12 +224,12 @@ trait EntityPage extends HtmlPage { } } { owner } -

{ displayName }

{ - if (tpl.isPackage) NodeSeq.Empty else

{companionAndPackage(tpl)}

- }{ permalink(tpl) } - { signature(tpl, isSelf = true) } +

{ displayName }{ permalink(tpl) }

+ { if (tpl.isPackage) NodeSeq.Empty else

{companionAndPackage(tpl)}

} + { signature(tpl, isSelf = true) } + { memberToCommentHtml(tpl, tpl.inTemplate, isSelf = true) }
@@ -234,7 +237,7 @@ trait EntityPage extends HtmlPage {
- +
@@ -772,7 +775,6 @@ trait EntityPage extends HtmlPage { case dtpl: DocTemplateEntity if isSelf && !isReduced && dtpl.linearizationTemplates.nonEmpty =>
- Linear Supertypes
{ @@ -795,7 +797,6 @@ trait EntityPage extends HtmlPage { if (subs.nonEmpty)
- Known Subclasses
{ @@ -815,7 +816,6 @@ trait EntityPage extends HtmlPage { if (diagramSvg != NodeSeq.Empty) {
- { description }
{ diagramSvg }
@@ -871,7 +871,6 @@ trait EntityPage extends HtmlPage { def inside(hasLinks: Boolean, nameLink: String = ""): NodeSeq = - { mbr.flags.map(flag => inlineToHtml(flag.text) ++ scala.xml.Text(" ")) } { kindToString(mbr) } @@ -969,7 +968,7 @@ trait EntityPage extends HtmlPage { else NodeSeq.Empty case alt: MemberEntity with AliasType => - = { typeToHtml(alt.alias, hasLinks) } + = { typeToHtml(alt.alias, hasLinks) } case tpl: MemberTemplateEntity if !tpl.parentTypes.isEmpty => extends { typeToHtml(tpl.parentTypes.map(_._2), hasLinks) } -- cgit v1.2.3