Setting up your IDE
You can use either Metals with your favorite editor or IntelliJ IDEA for Scala to work on the Scala 3 codebase. There are however a few additional considerations to take into account.
Bootstrapping Projects
The sbt build for dotty implements bootstrapping within the same build, so each component has two projects:
sbt:scala3> projects
...
[info] scala3-compiler
[info] scala3-compiler-bootstrapped
...
These duplicated projects can be confusing and cause issues in IDEs, so it's import to import the project in a specific way depending on your editor.
Metals
When using Metals, the -bootstrapped
projects are not exported by default. Normally this is fine, but if you're working on certain modules like scaladoc
you'll actually want these modules exported. In order to achieve this you'll want to make sure you do two things:
- You'll want to find and change the following above
commonBootstrappedSettings
which is found in theBuild.scala
file.
- val enableBspAllProjects = false,
+ val enableBspAllProjects = true,
- Run
sbt publishLocal
to get the needed presentation compiler jars.
By default Metals uses Bloop build server, however you can also use sbt directly. You can achieve this with the Metals: Switch Build Server
command and then choosing sbt. In VSCode, this looks like this:
IntelliJ
In IntelliJ IDEA, we recommend importing the dotty codebase through BSP, then the -bootstrapped
projects are not exported.