Skip to content

Commit

Permalink
update codegen: pass through AvailableWidthProvider implicit (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpollmeier authored Feb 14, 2024
1 parent 61cb6e8 commit 15912ac
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -786,18 +786,20 @@ class DomainClassesGenerator(schema: Schema) {
val domainMain =
s"""package $basePackage
|import flatgraph.DiffGraphBuilder
|import flatgraph.help.DocSearchPackages
|import flatgraph.help.Table.AvailableWidthProvider
|import Language.*
|
|object $domainShortName {
| val defaultDocSearchPackage = flatgraph.help.DocSearchPackages.default.withAdditionalPackage(getClass.getPackage.getName)
| val defaultDocSearchPackage = DocSearchPackages.default.withAdditionalPackage(getClass.getPackage.getName)
|
|@scala.annotation.implicitNotFound(
| \"\"\"If you're using flatgraph purely without a schema and associated generated domain classes, you can
| |start with `given DocSearchPackages = DocSearchPackages.default`.
| |If you have generated domain classes, use `given DocSearchPackages = MyDomain.defaultDocSearchPackage`.
| |If you have additional custom extension steps that specify help texts via @Doc annotations, use `given DocSearchPackages = MyDomain.defaultDocSearchPackage.withAdditionalPackage("my.custom.package)"`
| |\"\"\".stripMargin)
| def help(implicit searchPackageNames: flatgraph.help.DocSearchPackages) =
| def help(implicit searchPackageNames: DocSearchPackages, availableWidthProvider: AvailableWidthProvider) =
| flatgraph.help.TraversalHelp(searchPackageNames).forTraversalSources(verbose = false)
|
|@scala.annotation.implicitNotFound(
Expand All @@ -806,7 +808,7 @@ class DomainClassesGenerator(schema: Schema) {
| |If you have generated domain classes, use `given DocSearchPackages = MyDomain.defaultDocSearchPackage`.
| |If you have additional custom extension steps that specify help texts via @Doc annotations, use `given DocSearchPackages = MyDomain.defaultDocSearchPackage.withAdditionalPackage("my.custom.package)"`
| |\"\"\".stripMargin)
| def helpVerbose(implicit searchPackageNames: flatgraph.help.DocSearchPackages) =
| def helpVerbose(implicit searchPackageNames: DocSearchPackages, availableWidthProvider: AvailableWidthProvider) =
| flatgraph.help.TraversalHelp(searchPackageNames).forTraversalSources(verbose = true)
|
| def empty: $domainShortName = new $domainShortName(new flatgraph.Graph(GraphSchema))
Expand All @@ -825,10 +827,10 @@ class DomainClassesGenerator(schema: Schema) {
|class $domainShortName(private val _graph: flatgraph.Graph = new flatgraph.Graph(GraphSchema)) extends AutoCloseable {
| def graph: flatgraph.Graph = _graph
|
| def help(implicit searchPackageNames: flatgraph.help.DocSearchPackages) =
| $domainShortName.help(searchPackageNames)
| def helpVerbose(implicit searchPackageNames: flatgraph.help.DocSearchPackages) =
| $domainShortName.helpVerbose(searchPackageNames)
| def help(implicit searchPackageNames: DocSearchPackages, availableWidthProvider: AvailableWidthProvider) =
| $domainShortName.help
| def helpVerbose(implicit searchPackageNames: DocSearchPackages, availableWidthProvider: AvailableWidthProvider) =
| $domainShortName.helpVerbose
|
| override def close(): Unit =
| _graph.close()
Expand Down

0 comments on commit 15912ac

Please sign in to comment.