Skip to content

Commit

Permalink
Review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
KacperFKorban committed Jul 5, 2021
1 parent b388048 commit 6adf3f6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ object Build {
scalaSrcLink(stdLibVersion, srcManaged(dottyNonBootstrappedVersion, "scala") + "="),
dottySrcLink(referenceVersion, srcManaged(dottyNonBootstrappedVersion, "dotty") + "=", "#library/src"),
dottySrcLink(referenceVersion),
) ++ scalacOptionsDocSettings ++ revision ++ params ++ targets ++ Seq("-generate-inkuire")
) ++ scalacOptionsDocSettings ++ revision ++ params ++ targets ++ Seq("-Ygenerate-inkuire")
import _root_.scala.sys.process._
val escapedCmd = cmd.map(arg => if(arg.contains(" ")) s""""$arg"""" else arg)
Def.task {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class InkuireJSSearchEngine {
)
}

def query(s: String)(callback: PageEntry => Node)(endCallback: String => Node): List[PageEntry] = {
def query(s: String)(callback: PageEntry => Unit)(endCallback: String => Unit): List[PageEntry] = {
worker.onmessage = _ => ()
val res = ListBuffer[PageEntry]()
val func = (msg: MessageEvent) => {
Expand Down
4 changes: 2 additions & 2 deletions scaladoc/resources/dotty_res/scripts/inkuire.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ Inkuire is a Hoogle-like search engine for Scala 3 (and Kotlin).

# Usage

To include Inkuire in scaladoc one should add `-generate-inkuire` flag. This will allow the usage of Inkuire for generated Scaladoc with project sources and available sources from external-mappings.
To include Inkuire in scaladoc one should add `-Ygenerate-inkuire` flag. This will allow the usage of Inkuire for generated Scaladoc with project sources and available sources from external-mappings.

The Inkuire worker works in Scaladoc searchbar. It is triggered once an input containing `=>` is detected in searchbar. There is 1s debounce on searches with Inkuire.

## Generated Files

When including `-generate-inkuire` flag database for project sources and a config should be generated. Which are namely files: `inkuire-db.json` and `scripts/inkuire-config.json`. Config file includes addresses of possible inkuire-db files. There always is at least one - generated one. But also links for external mappings are addes on relative path `../inkuire-db.json`.
When including `-Ygenerate-inkuire` flag database for project sources and a config should be generated. Which are namely files: `inkuire-db.json` and `scripts/inkuire-config.json`. Config file includes addresses of possible inkuire-db files. There always is at least one - generated one. But also links for external mappings are addes on relative path `../inkuire-db.json`.

`inkuire-db.json` contains a json with Inkuire engine's representation of:
- types (or rather classes and objects for now)
Expand Down
4 changes: 2 additions & 2 deletions scaladoc/src/dotty/tools/scaladoc/Inkuire.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ object Inkuire {
var db = InkuireDb(Seq.empty, Map.empty, Seq.empty)

def generateInkuireConfig(externalMappings: Seq[String]): String = {
val paths = ("../inkuire-db.json" +: externalMappings.map(_ + "../inkuire-db.json")).map(p => "\"" + p + "\"")
s"""{"inkuirePaths": [${paths.mkString(",")}]}"""
val paths = ("../inkuire-db.json" +: externalMappings.map(_ + "../inkuire-db.json")).map(jsonString)
jsonObject(("inkuirePaths", jsonList(paths))).toString
}

case class InkuireDb(
Expand Down
2 changes: 1 addition & 1 deletion scaladoc/src/dotty/tools/scaladoc/ScaladocSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class ScaladocSettings extends SettingGroup with AllScalaSettings:
BooleanSetting("-Ysnippet-compiler-debug", snippets.SnippetCompilerArgs.debugUsage, false)

val generateInkuire: Setting[Boolean] =
BooleanSetting("-generate-inkuire", "Generates InkuireDB and enables Hoogle-like searches", false)
BooleanSetting("-Ygenerate-inkuire", "Generates InkuireDB and enables Hoogle-like searches", false)

def scaladocSpecificSettings: Set[Setting[_]] =
Set(sourceLinks, syntax, revision, externalDocumentationMappings, socialLinks, skipById, skipByRegex, deprecatedSkipPackages, docRootContent, snippetCompiler, snippetCompilerDebug, generateInkuire)

0 comments on commit 6adf3f6

Please sign in to comment.