質問

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?

役に立ちましたか?

解決

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 :)

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top