-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Scala3doc: Fix searchbar to match only by name #10263
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
Conversation
32b847c
to
410d1ca
Compare
object PluginUtils: | ||
import scala.reflect.ClassTag | ||
import scala.reflect._ | ||
def query[T <: DokkaPlugin, E](ctx: DokkaContext, queryFunction: (T) => ExtensionPoint[E])(implicit tag: ClassTag[T]): List[E] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe:
def plugin[T <: DokkaPlugin: ClassTag](ctx: DokkaContext) =
ctx.plugin[T](getKotlinClass(implicitly[ClassTag[T]].runtimeClass.asInstanceOf[Class[T]]))
def query[T <: DokkaPlugin: ClassTag, E](ctx: DokkaContext, queryFunction: (T) => ExtensionPoint[E]): List[E] =
ctx.get(queryFunction(plugin[T](ctx))).asScala.toList
def querySingle[T <: DokkaPlugin: ClassTag, E](ctx: DokkaContext, queryFunction: (T) => ExtensionPoint[E]): E =
ctx.single(queryFunction(plugin[T](ctx)))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks better
@@ -40,6 +41,19 @@ class SignatureRenderer(pageContext: ContentPage, sourceSetRestriciton: JSet[Dis | |||
|
|||
class ScalaHtmlRenderer(ctx: DokkaContext) extends HtmlRenderer(ctx) { | |||
|
|||
// TODO #239 | |||
val hackScalaSearchbarDataInstaller: SearchbarDataInstaller = { | |||
import java.lang.reflect.Field; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that code below will work as well (without nasty warnings):
val f = classOf[HtmlRenderer].getDeclaredField("searchbarDataInstaller")
f.setAccessible(true)
f.set(this, ScalaSearchbarDataInstaller(ctx))
f.get(this).asInstanceOf[ScalaSearchbarDataInstaller]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
||
case class PageEntry(val name: String, val signature: String, val link: String, val pkg: String) | ||
|
||
val pages = TrieMap[String, PageEntry]() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can add a comment that this is such a strange piece of code (concurrent collection, mutable state etc.) due to dokka?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
override def processPage(page: ContentPage, link: String) = | ||
Option(page.getDocumentable) match { | ||
case Some(member) => processMember(member, link) | ||
case None => () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add support for titles from static documentation nodes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added support
55d6fe9
to
198d62e
Compare
198d62e
to
9e4bdc7
Compare
@smarter it seems that |
Not that I know of, /cc @liufengyun |
It's fix of a bug reported in #200