Attaching sources in IntelliJ IDEA for scala project

社会主义新天地 提交于 2019-12-21 04:05:02

问题


I have Playframework 2 project with Scala (very small one). It uses Scala Anorm library.

I have the code like this:

package models
..
import anorm.SqlParser._
...

val rowParser = scalar[Long]

So, I would like to see source of scalar method. Trying to attache the sources I have in my plaframework source folder, but IDEA just swallows my request and does nothing back.

I use last version of IDEA and Scala plugin. Is it bug, probably?


回答1:


Aha.. fixed.

So: I used to use 'attach source' in the top of the window editor - it does not work (I guess it is a bug - maybe related to the scala plugin, because usually it works).

But if try to attache sources to particular library - in "Project Structure -> Library -> +Attach File or Directories -> Sources" then it works.

Thanks.




回答2:


First download source code :

1.) Click on this link : http://www.scala-lang.org/download/all.html

2.) Choose any scala version.

3.) Now in the last section 'Other Resources' you can see 'Sources' link. Click on it to download. In my case (https://codeload.github.com/scala/scala/tar.gz/v2.11.7)

Now point to this Source Code from IntelliJ.

1.) Open Project Structure in IntelliJ. Shorcut (Cmd + DownArrow)

2.) Select Global Libraries from the left section.

3.) Then on right side, Under 'Scala Library' section. Click '+' and point to source directory. See the screenshot.




回答3:


To fix it we need to do some changes into IntelliJ IDEA platform. Most probably it will be fixed in IntelliJ IDEA 13.1.




回答4:


I have the same problem. I installed "Scala Imports Organizer", and problem was solved.



来源:https://stackoverflow.com/questions/13520532/attaching-sources-in-intellij-idea-for-scala-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!