Skip to content

Add support for anchors to old scaladoc and javadoc #11564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 5, 2021

Conversation

pikinier20
Copy link
Contributor

closes #11085

@pikinier20 pikinier20 force-pushed the external-location-anchors branch from 7a3f839 to ac6acf7 Compare March 1, 2021 09:11
@pikinier20 pikinier20 marked this pull request as ready for review March 1, 2021 12:14
@pikinier20 pikinier20 requested a review from romanowski March 1, 2021 12:15
private def transformType(tpe: TypeRepr): String = tpe.simplified match {
case AppliedType(tpe, typeList) if tpe.show == "scala.Array" => transformType(typeList.head) + ":A"
case AppliedType(tpe, typeList) if tpe.show == "scala.<repeated>" => transformType(typeList.head) + "..."
case AppliedType(tpe, typeList) => transformPrimitiveType(tpe.show)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we compare symbols or types here? Output of show is not guaranteed to be stable.

import q.reflect._
import dotty.tools.dotc
given ctx: dotc.core.Contexts.Context = q.asInstanceOf[scala.quoted.runtime.impl.QuotesImpl].ctx
val csym = sym.asInstanceOf[dotc.core.Symbols.Symbol]
Option(csym.associatedFile).fold("")(_.path)
Option(csym.associatedFile).map(_.path).flatMap( path =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you notice any slowdown after these changes? especially this line may affect performance so we may consider caching (this needs to be tested with scala 3 doc not, the self one)

val originPath = {
val className = sym.className

val location = className.fold(sym.packageName)(cn => s"${sym.packageName}.${cn}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can work with Seq[Sring] rather then concatenate and then split it later on in each branch

@pikinier20 pikinier20 force-pushed the external-location-anchors branch from e82ffcd to d60bf45 Compare March 2, 2021 09:48
@pikinier20 pikinier20 requested a review from romanowski March 2, 2021 09:49
@pikinier20 pikinier20 merged commit 0d51319 into master Mar 5, 2021
@pikinier20 pikinier20 deleted the external-location-anchors branch March 5, 2021 11:35
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for external linking to anchors in Javadoc and Scaladoc
4 participants