Is it possible to use Ensime and SBT to go to the definition of Scala library classes?
I know it is possible to see the definition of elements (using M-. or Control+Left-Click) and from there it's possible to see the doc page. Is there any way to tie this functionality into src as well?
UPDATE:
my project config (.ensime file):
(
:root-dir "/Users/eugene/tmp/scrap"
:sources (
"/Users/eugene/tmp/scrap"
)
:reference-source-roots (
"/usr/local/Cellar/scala/2.9.2/libexec/src"
)
:compile-deps (
""
)
:target "/Users/eugene/tmp/scrap"
)
/usr/local/Cellar/scala/2.9.2/libexec/src contains:
scala-compiler-src.jar scala-library-src.jar scala-swing-src.jar
scala-dbc-src.jar scala-partest-src.jar scalap-src.jar
build.sbt:
name := "scrap"
version := "0.1-SNAPSHOT"
scalaVersion := "2.9.2"
sbt's Scala version sbt needs Scala jars to run itself since it is written in Scala. sbt uses that same version of Scala to compile the build definitions that you write for your project because they use sbt APIs.
Having said that, at the very beginning, sbt will always download its own internal dependencies, Scala including. It is then saved in ~/.
We’ll use sbt, the de facto build tool for Scala. sbt compiles, runs, and tests your projects among other related tasks. We assume you know how to use a terminal. Run javac -version in the command line and make sure you see javac 1.8.___ cd to an empty folder. Run the following command sbt new scala/hello-world.g8 .
Learn more about sbt new and project templates in the documentation of sbt. While sbt is widely used, there are other tools you can use to build Scala projects: In a related note, Coursier is a “dependency resolver,” similar to Maven and Ivy in function.
If you want to create a Scala 3 project that cross-compiles with Scala 2, use the template scala/scala3-cross.g8: Learn more about sbt new and project templates in the documentation of sbt. While sbt is widely used, there are other tools you can use to build Scala projects:
Here, libraryDependencies is a set of dependencies, and by using += , we’re adding the scala-parser-combinators dependency to the set of dependencies that sbt will go and fetch when it starts up. Now, in any Scala file, you can import classes, objects, etc, from scala-parser-combinators with a regular import.
Download the sources of scala-library and then set :reference-source-roots
in your project config file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With