【问题标题】:Configure scaladoc to include extension methods配置 scaladoc 以包含扩展方法
【发布时间】:2014-01-28 12:59:40
【问题描述】:

我可以通过指定隐式转换来配置 scaladoc 以包含来自隐式转换的方法吗?

例如给定

trait Foo

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

我可以让scaladoc在Foo的文档中包含扩展方法bar吗?

【问题讨论】:

    标签: scala implicit-conversion scaladoc enrich-my-library


    【解决方案1】:

    看起来是这样(我还没试过):

    % 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)
      ...
    

    【讨论】:

    • 谢谢。这确实适用于默认范围内的隐式转换,例如在 Foo 所在的包对象内。但是,它不包含任何必须导入的扩充项,例如示例中的Operations。不知道有没有其他的技巧可以做到这一点?
    • 我也不知道,但可能不知道?
    • 您是否尝试在上面定义trait Foo 的位置添加import Operations._?这可能会诱使 scaladoc 工具包含隐式方法
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-02-20
    • 1970-01-01
    • 1970-01-01
    • 2012-11-28
    • 2015-12-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多