How to search for methods in Scaladoc, globally?

前端 未结 3 963
情话喂你
情话喂你 2021-02-18 18:54

Is there any possibility that i can search for a method in a class, trait or object via scala doc, globally? Example: I have a method name and I don\'t know which class it belon

3条回答
  •  独厮守ぢ
    2021-02-18 19:08

    colladoc

    The colladoc tool has a more useful search interface to the scaladocs than the standard scaladoc tool.

    You can restrict the search to method names by prefixing the search string with "def", as in "def implicitly". If you click on the magnifying glass next to the search box, with an empty search string, you'll get the following handy list of sample queries:

    • any searches for everything that has the word any in its name, definition or comment
    • any_ searches for everything that starts with any
    • //_any searches for all comments that contain a word that ends with any
    • class AnyRef searches for all classes with name AnyRef
    • trait _ searches for all traits
    • object _ searches for all objects
    • class A_ || class B_ searches for all classes that starts with A or B
    • class _ extends _ with _ searches for all classes that extend a class and implement a trait
    • var _: Int searches for all values or variables of type Int, vars are displayed before the vals
    • def toString searches for all methods with name toString
    • def toString : String searches for all methods with name toString and return type String
    • def _(_) : Boolean searches for all methods with one argument and returnType Boolean
    • def _(Int, _) searches for all methods with arguments and the first is of type Int
    • def _(_, *) searches for all methods with one or more arguments
    • def _(Iterable[_]):Int searches for all methods that take an Iterable and return Int
    • (Iterable[_]) => Int equvalent to the above, lambda syntax can also be used for searching for methods.
    • => (_, _) searches for all methods that return a tuple with two elements.
    • def _((_) => _) searches for all methods that have one as first parameter a method that takes and returns any value.

    Unfortunately, colladoc's search results can be daunting. If a member exists in many traits/classes due to inheritance (e.g. the sum method in the collections API), all of the classes are listed in the results.

    scaladoc Alphabetical Index

    There's no such search in scaladoc itself, but there is an alphabetic index that contains class/object/trait members. Just click on one of the letters below the search bar in the top left corner, and you'll see a list containing classes, objects, traits, and members starting with that letter (or symbols, if you click on the "#" link). Then you can use your browser's find function to look for the member you're interested in.

提交回复
热议问题