diff --git a/scaladoc-js/main/src/searchbar/SearchbarComponent.scala b/scaladoc-js/main/src/searchbar/SearchbarComponent.scala index c33667f04e73..9741c6681024 100644 --- a/scaladoc-js/main/src/searchbar/SearchbarComponent.scala +++ b/scaladoc-js/main/src/searchbar/SearchbarComponent.scala @@ -62,11 +62,14 @@ class SearchbarComponent(engine: SearchbarEngine, inkuireEngine: InkuireJSSearch icon.classList.add(m.entryType.take(2)) val resultA = document.createElement("a").asInstanceOf[html.Anchor] + // Inkuire pageLocation should start with e (external) + // or i (internal). The rest of the string is an absolute + // or relative URL resultA.href = - if(new URI(m.pageLocation).isAbsolute()) { - m.pageLocation + if (m.pageLocation(0) == 'e') { + m.pageLocation.substring(1) } else { - Globals.pathToRoot + m.pageLocation + Globals.pathToRoot + m.pageLocation.substring(1) } resultA.text = m.functionName resultA.onclick = (event: Event) => diff --git a/scaladoc/src/dotty/tools/scaladoc/Inkuire.scala b/scaladoc/src/dotty/tools/scaladoc/Inkuire.scala index f1b9414c9835..52b677c30e6a 100644 --- a/scaladoc/src/dotty/tools/scaladoc/Inkuire.scala +++ b/scaladoc/src/dotty/tools/scaladoc/Inkuire.scala @@ -114,6 +114,7 @@ object Inkuire { name: String, packageName: String, uri: String, + isLocationExternal: Boolean, entryType: String ) @@ -333,7 +334,7 @@ object Inkuire { ("signature", serialize(e.signature)), ("name", serialize(e.name)), ("packageName", serialize(e.packageName)), - ("uri", serialize(e.uri)), + ("uri", serialize((if e.isLocationExternal then "e" else "i") + e.uri)), ("entryType", serialize(e.entryType)) ) } diff --git a/scaladoc/src/dotty/tools/scaladoc/tasty/InkuireSupport.scala b/scaladoc/src/dotty/tools/scaladoc/tasty/InkuireSupport.scala index 3d65094d249a..1f3b353eb045 100644 --- a/scaladoc/src/dotty/tools/scaladoc/tasty/InkuireSupport.scala +++ b/scaladoc/src/dotty/tools/scaladoc/tasty/InkuireSupport.scala @@ -115,6 +115,7 @@ trait InkuireSupport(using DocContext) extends Resources: name = name, packageName = ownerName, uri = methodSymbol.dri.externalLink.getOrElse(escapedAbsolutePathWithAnchor(methodSymbol.dri)), + isLocationExternal = methodSymbol.dri.externalLink.isDefined, entryType = "def" ) val curriedSgn = sgn.copy(signature = Inkuire.curry(sgn.signature)) @@ -143,6 +144,7 @@ trait InkuireSupport(using DocContext) extends Resources: name = name, packageName = ownerName, uri = valSymbol.dri.externalLink.getOrElse(escapedAbsolutePathWithAnchor(valSymbol.dri)), + isLocationExternal = valSymbol.dri.externalLink.isDefined, entryType = "val" ) val curriedSgn = sgn.copy(signature = Inkuire.curry(sgn.signature))