How do I add source for Scala libraries to an IDEA project?

Event after attaching Scala source code (either source jars or source directories) to my project libraries, when I ctrl-click a library method, I get taken to the ".class" file with just method declarations.

Does this feature work for Scala?

13 comments
Comment actions Permalink

Bill, are you referring to the Scala runtime library itself or a third-party library written in Scala?

0
Comment actions Permalink

Third-party libraries

0
Comment actions Permalink

Using IDEA 10.5 and Scala plugin nightly build 1075, I was able to add the scalatest library to a test project, with source directories attached to the library, add an import for org.scalatest.Spec to a Scala class file in my test project and ctr-click to the source for the Spec class.

Maybe double-check that you're attaching the correct source directories/archives to your library?

0
Comment actions Permalink

So, looking into the problem a little more closely, the source libraries do indeed get added to the project - if I press Cmd-Shift-O ("Go to file"), I can open the Scala source for any file.

However, when I ctrl-click on a method in a third-party library whose source is included in the project, it brings me to the .class file rather then the .scala file.

0
Comment actions Permalink

That's a bug. Is it same for any method invocation into third-party library?

Best regards,
Alexander Podkhalyuzin.

0
Comment actions Permalink

Hi Alexander,

It's the same for every method and library I've tried. Also, if I try to jump to a method from the debugger stacktrace, that takes me to the .class files as well.

Bill

0
Comment actions Permalink

Any known workarounds?

0
Comment actions Permalink

I upgraded to the nightly build of the Scala plugin.

I still get .class files when I control-click, but now clicking a function in the debugger's Frames dialog works. Not sure if that information helps.

0
Comment actions Permalink

Hmm. On further inspection, only some entries in Frames take me to .scala files; many still take me to .class files (this is for methods whose sources are on my path, of course)

0
Comment actions Permalink

It will be great if you find a way to give me some sample project with all dependencies. Then I'll be able to fix it in your case. Or I need more information, maybe for example link to third-party library with some simple usage.

Best regards,
Alexander Podkalyuzin.

0
Comment actions Permalink

I have been trying to set up a scala project using the 2.9.0.1 release (by Typesafe) but just can't get the IDE to open up the source files for the libraries (using CMD-B). Any suggestions (other than the ones allready given in this discussion)?

0
Comment actions Permalink

Unfortunately, I can't reproduce your problem. Can you give me a sample project with your setup to reproduce this problem?

Best regards,
Alexander Podkhalyuzin.

0

Please sign in to leave a comment.