SBT sources in IDEA

2019-01-16 11:59发布

I'm using *.scala files in the project folder for configuring my SBT project. I'm using IDEA12 with the Scala Plugin and sbt-idea for generating the project. After calling gen-idea in the SBT shell, everything works fine except for one thing. When I click go to declaration on some method in my project code, IDEA shows me how it is implemented (redirects me to the library sources). But when I'm trying to "inspect" SBT's internal sources it shows me something like this:

def settings: Seq[Setting[_]] = { /** compiled code **/ }

How can I attach SBT sources to my IDEA project?

I'm using SBT 0.12.3.

1条回答
手持菜刀,她持情操
2楼-- · 2019-01-16 12:09

In SBT there are two command which may interest you:

update-classifiers - will download all sources and documentation for all libs in your project
update-sbt-classifiers - downloads sbt sources and docs

This will download all the sources you need. To make an IDEA project with them just call gen-idea sbt-classifiers.

If you don't want to call each time this commands for re-generating you project, you should add something like this to your build.sbt: addCommandAlias("make-idea", ";update-classifiers; update-sbt-classifiers; gen-idea sbt-classifiers").

查看更多
登录 后发表回答