3

Can I configure scaladoc to include methods from implicit conversions by specifying the implicit conversion?

E.g. given

trait Foo

object Operations {
  implicit class FooOps(val f: Foo) extends AnyVal {
    def bar = 33
  }
}

Can I make scaladoc include extension method bar in the documentation of Foo?

0__
  • 66,707
  • 21
  • 171
  • 266

1 Answers1

1

It appears so (I've not tried it yet):

% scladoc -help
Usage: scaladoc <options> <source files>
where possible scaladoc options include:
  ...
  -implicits                    Document members inherited by implicit conversions.
  -implicits-hide:<implicit(s)> Hide the members inherited by the given comma separated, fully qualified implicit conversions. Add dot (.) to include default conversions.
  -implicits-show-all           Show members inherited by implicit conversions that are impossible in the default scope. (for example conversions that require Numeric[String] to be in scope)
  ...
Randall Schulz
  • 26,420
  • 4
  • 61
  • 81
  • Thanks. This does work for implicit conversions which are in default scope, e.g. inside the package object in which `Foo` resides. However, it doesn't include any enrichments which must be imported, like `Operations` in the example. I don't know if there are further tricks to achieve this? – 0__ Jan 29 '14 at 11:10
  • I don't know either, but probably not? – Randall Schulz Jan 29 '14 at 14:08
  • did you try adding an `import Operations._` above where `trait Foo` is defined? that might trick scaladoc tool into including the implicit method – john sullivan Dec 27 '17 at 22:07