4

Scala is installed using homebrew, and when I create a new Scala project, I use the path /usr/local/opt/scala/idea with the proper symlinks

IntelliJ create new Scala project

IntelliJ detects the compiler and libraries correctly, auto-complete, compilation and running works fine.

The problem is IntelliJ does not detect the Scala API documentation, even though the Javadocs path is correct

Scala API docs path

The contents of the directories look correct too:

hanxue-mac:idea hanxue$ ls doc/scala-devel-docs/api index index.js package.html index.html lib scala hanxue-mac:idea hanxue$ ls /usr/local/opt/scala/idea doc lib src hanxue-mac:idea hanxue$ ls /usr/local/opt/scala/idea/doc/scala-devel-docs/api index index.js package.html index.html lib scala

This is a screenshot when I select a Scala class and press Ctrl+J

Scala documentation not found

Note that I have the same problem in IntelliJ Idea 132.719 as well as IntelliJ Idea 12 CE. How should I set up the Javadocs path for Scala API?

Hanxue
  • 12,243
  • 18
  • 88
  • 130

1 Answers1

5

I know I am giving this answer repeatedly, but... If you set up your project with sbt and sbt-idea (task gen-idea), you get a correctly set up scala-library with documentation.

Here is a screenshot of an example project, perhaps you can use this approach manually—it uses a dedicated jar scala-library-2.10.3-javadoc.jar instead of pointing to an extracted API folder:

enter image description here

IDEA seems to have problems with type aliases (e.g. import collection.immutable.{IndexedSeq => Vec} means it won't look up the doc of Vec.empty), but in general it works as expected:

enter image description here

(Oops, doesn't paste in doc macros, like $bfinfo and $thatinfo :)

0__
  • 66,707
  • 21
  • 171
  • 266
  • Thank you very much @0__ I did not try sbt-idea earlier because I thought ideally all Scala related settings should be set within `IntelliJ` to prevent any complications. Is the Javadocs jar file dynamically generated each time sbt-idea is used? Is it still possible to set up the API Docs path from within IntelliJ? – Hanxue Oct 28 '13 at 18:13
  • 3
    The docs are not generated, but they are downloaded from the internet, from where the scala library itself is also grabbed (e.g. http://search.maven.org/#artifactdetails|org.scala-lang|scala-library|2.10.3|jar ). If you download the javadoc-jar from this link, you should be able to set up the path from within IntelliJ, just as shown in the first screenshot. – 0__ Oct 28 '13 at 18:33