How to attach scaladoc / sources for libraries used?

Hi,

how can i configure my project so that when i press Ctrl+J to look up a class or method, i not only get the plain parameter list, but the actual scaladocs that go with it? I tried to use attach-sources in project settings -> libraries, but that didn't make any difference. it would be a huge help to be able to lookup the corresponding docs.

thanks!

best wishes, -sciss-

5 comments
Comment actions Permalink

hello,

i still can't get it to work. i have set up the project to use sbt. the scala-library used is buildScala:
Modules.jpg
if i go the project-settings -> libraries, and attach the docs from my dependancy library (ScalaCollider in this case):
Libraries.jpg
i don't see IDEA indexing anything, and in the code editor, ctrl+J still doesn't bring up any of the docs:
Editor.jpg

this is what i expect to see:


   /**
    * Sets the contents of the buffer by replacing
    * individual contiguous chunks of data. An error is thrown if any of the given
    * ranges lies outside the valid range of the entire buffer.
    *
    * @param   pairs a list of modifications to the buffer contents, each element
    *          being a sample offset and a chunk of values. The data is channel-interleaved,
    *          e.g. for a stereo-buffer,, the offset for the right channel's fifth frame
    *          is `(5-1) * 2 + 1 = 9`. Accordingly, values in the float-sequences are
    *          considered channel-interleaved, i.e. for a stereo buffer and an even offset,
    *          the first element of the sequence refers to frame `offset / 2` of the
    *          left channel, the second element to frame `offset / 2` of the right channel,
    *          followed by frame `offset / 2 + 1` of the left channel, and so on.
    */



thanks again, -sciss-

0
Comment actions Permalink

So, as far as I understood, you want to see a documentation not for the standard Scala library, but for your own module.

You've attached a dependency to ScalaCollider module indirectly, via a jar file, that contains no documentation, that's why Ctrl+J shows nothing.

There are two ways to make scaladocs visible:

  • Add direct dependency to ScalaCollider module into ScalaColliderTest (press "Add / Module Dependency"). I think, that's a preffered method, because that way you may see all changes to ScalaCollider sources (and docs) immediately, without the need to recompile anithing.
  • Build scaladocs for ScalaCollider module and add them togeter with the classes jar to ScalaColliderTest module.
0
Comment actions Permalink

hey, i got it: it doesn't work when i add the docs to the scala-library. instead i need to create another separate library.

so what i did for this library

run sbt package package-docs package-src, so i have the three necessary jar files

project settings --> global libraries --> +

add classes, add sources, add documentation --> point to those jar files

GlobalLib.jpg

apply.

then in the dependant project, go to dependancies, remove the previous entry to the .jar file from lib_managed, instead add the global library.

UseGlobalLib.jpg

then IDEA performs indexing, and documentation comes up:

EditorWorks.jpg

great!

best, -sciss-

0
Comment actions Permalink

You may consider adding a dependency to ScalaCollider module directly, without the intermediate library.

0

Please sign in to leave a comment.