Possible to attach Scala compiler sources?


By any chance, is it possible to attach the sources of the Scala compiler?

I was just trying out the Scala plugin for IDEA and found that I can easily attach the sources for the Scala standard library (after they're not found, I simply have to click "attach sources" in the upper right and include the path to the sources). The sources directory that I include also contains the Scala compiler sources (I include this dir: https://github.com/scala/scala/tree/v2.10.0-M6/src), however, the compiler subdirectory ends up not being included. Trying to manually include only the Scala compiler source directory results in nothing, no error message, nothing happens, no sources attached. I guess my question is, by what definition is a source directory a "root" directory, and why is it that scala/src/actors or scala/src/library are root directories that are included when I "attach" them, but not scala/src/compiler?


1 comment
Comment actions Permalink

You don't want the sources as source of the project—i.e. to compile the compiler sources—but only attach them as sources to a dependency—i.e. your project uses the compiler as a library, right?

Because in that case you simply add the sources jar in Project Structure -> Libraries

I have a attached a screenshot for a project that uses the compiler as library. I can then from my source code open any call into the compiler (interpreter in that case), either in the editor or during debugging. The project was automatically set up by the sbt-idea-plugin, something I can highly recommend when your project is sbt based. Just execute `sbt gen-idea` and (re-)open the project in IDEA.

Screen shot 2012-08-16 at 12.19.21.png

Please sign in to leave a comment.