docs/_docs/contributing/setting-up-your-ide.md
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.
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.
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:
commonBootstrappedSettings which is found in the
Build.scala
file.
- val enableBspAllProjects = false,
+ val enableBspAllProjects = true,
Run in sbt shell sbt> scala3-bootstrapped/compile and then sbt> scala3-bootstrapped/publishLocalBin
to get the required presentation compiler jars.
If any step fails due to random errors, try removing ./out/ directory and running sbt> clean
This step has to be repeated every time compiler version has been bumped.
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:
In IntelliJ IDEA, we recommend importing the dotty codebase through BSP, then
the -bootstrapped projects are not exported.