score:21
Scaladocs are generated as HTML, so you don't want them appearing in the REPL window. You might want to load docs in a browser from the REPL, however. You can do that by creating your own method like so (this one takes an instance; you could have it take an instance of Class[A]
instead, if you prefer):
def viewdoc[A](a: A) {
val name = a.asInstanceOf[AnyRef].getClass.getName
val url = "http://www.scala-lang.org/api/current/index.html#"+name
val pb = new ProcessBuilder("firefox",url)
val p = pb.start
p.waitFor
}
If you want to get extra-clever, you could parse the name to point the web browser at Javadocs for java classes and Scaladocs for Scala classes and wherever you have your documentation for your classes. You also probably want to use a local source, file:///my/path/to/docs/index.html#
instead of the API from the web. But I used this so you can try out
scala> viewdoc(Some(1))
Source: stackoverflow.com
Related Query
- How do I access scala documentation from the repl?
- How to access files in the resources directories from scala source using sbt layout
- How do I get the Scala version from within Scala itself?
- How does the “scala.sys.process” from Scala 2.9 work?
- How are Scala collections able to return the correct collection type from a map operation?
- Scala 2.10 reflection, how do I extract the field values from a case class, i.e. field list from case class
- How do I abstract the domain layer from the persistence layer in Scala
- How can I access the last result in Scala REPL?
- How to populate java.util.HashMap on the fly from Scala code?
- How do I access post data from scala play?
- Viewing the contents in <function1> from the scala repl
- How to run an external file from within the scala interactive interpreter (REPL)?
- How can I idiomatically "remove" a single element from a list in Scala and close the gap?
- How to call main method of a Scala program from the main method of a java program?
- How to upgrade Scala to a newer version from the command line?
- How to access a Java static method from Scala given a type alias for that class it resides in
- How to access an object Foo contained in a scala package object from Java?
- How To Access access Case class field Value from String name of the field
- How can an implicit be unimported from the Scala repl?
- How to modify previous line in REPL - scala to modify the typing errors to save time compare to entering each line using up/down arrows
- How do I run Scala + specs2 from the command line?
- How to get auto-complete in Scala REPL launched from ensime?
- Why can I use a Java lib from the Scala REPL but not from a script?
- How do I make sbt use the scala binaries from $SCALA_HOME directory?
- Running the scala REPL from gradle?
- How can I keep -Xcheckinit from interfering with the deserialization of Scala objects?
- How can I get the functionality of the Scala REPL :type command in my Scala program
- How can I find the statements in a Scala program from within a compiler plugin?
- How can I access the new javascript keyword from scala.js?
- How to best implement "first success" in Scala (i.e., return the first success from a sequence of failure-prone operations)
More Query from same tag
- "Prolog style" in Scala: mixing with procedural code?
- capture an image in android with fixed size
- Scala + ZMQ = Operation cannot be accomplished in current state
- Scala Yeild returning Try[Either[]] rather then Either
- Scala: Mis-using traits, gives runtime error
- How to calculate the size of dataframe in bytes in Spark?
- How to run docker commands in Scala?
- Best way to write Scala methods signature dealing with exceptions
- How to create scala recursive method
- FlatSpec displays strange behaviour while using 'should contain only'
- Why is the function heads not implemented in List
- Correct syntax for updating nested map using Monocle
- How does one replace the first matching item in a list in Scala?
- Pass arguments to a specific test framework when using test-only with SBT
- Custom assertion on Gatling
- Coproducts in shapeless does not compile
- Boxing Double during Array.tabulate
- Spark runs on Yarn cluster exitCode=13:
- Scala Monad - Full worked example
- Disable sbt subproject doc generation
- How Do I Create Custom Actions in Play! 2.0 Framework?
- Spark Structured Streaming Run Final Operation on External Table (MSCK REPAIR)
- json4s and Joda Time
- How to implement a real Singleton in Scala
- Running Scala^Z3 with Scala 2.10
- Is there a way to split by Custom Delimiter in Spark(with Scala) and not read line by line, to read a set of key, value pairs?
- Anything similar to SqlSoup for Scala?
- How to get comma separated values from List of Maps in Scala?
- Using par map to increase performance
- For comprehension with optional collection iteration and yield