Skip to content

Commit

Permalink
improvement: Remove workaround for Bloop and update docs (#21842)
Browse files Browse the repository at this point in the history
Bloop plugin will now use bspEnabled setting same as sbt
  • Loading branch information
tgodzik authored Oct 31, 2024
2 parents 71b0aea + c450073 commit 24038b8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 49 deletions.
30 changes: 15 additions & 15 deletions docs/_docs/contributing/setting-up-your-ide.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ layout: doc-page
title: Setting up your IDE
---

You can use either Metals with your favorite editor (VS Code, Neovim, Sublime)
or [IntelliJ IDEA for
Scala](https://www.jetbrains.com/help/idea/discover-intellij-idea-for-scala.html)
You can use either Metals with your favorite editor or
[IntelliJ IDEA for Scala](https://www.jetbrains.com/help/idea/discover-intellij-idea-for-scala.html)
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:
The sbt build for dotty implements bootstrapping within the same build, so each
component has two projects:

```
sbt:scala3> projects
Expand All @@ -32,23 +31,24 @@ 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:

1. You'll want to find and change the following under
`commonBootstrappedSettings` which is found in the
[`Build.scala`](https://github.com/scala/scala3/blob/main/project/Build.scala)
file.
1. You'll want to find and change the following above
`commonBootstrappedSettings` which is found in the
[`Build.scala`](https://github.com/scala/scala3/blob/main/project/Build.scala)
file.

```diff

- bspEnabled := false,
+ bspEnabled := true,
- val enableBspAllProjects = false,
+ val enableBspAllProjects = true,
```

2. Set `sbt` as your build server instead of the default, Bloop. You can achieve
this with the `Metals: Switch Build Server` command and then choosing sbt. In
VSCode, this looks like this:
2. Run `sbt publishLocal` to get the needed presentation compiler jars.

![bsp-switch](https://user-images.githubusercontent.com/777748/241986423-0724ae74-0ebd-42ef-a1b7-4d17678992b4.png)
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:

![bsp-switch](https://user-images.githubusercontent.com/777748/241986423-0724ae74-0ebd-42ef-a1b7-4d17678992b4.png)

### IntelliJ

Expand Down
16 changes: 13 additions & 3 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,20 @@ object Build {
) ++ extMap
}

/* These projects are irrelevant from IDE point of view and do not compile with Bloop*/
val fullyDisabledProjects = Set(
"scala2-library-cc",
"scala2-library-bootstrapped",
"scala2-library-cc-tasty",
"scala2-library-tasty"
)

val enableBspAllProjects = false

// Settings used when compiling dotty with a non-bootstrapped dotty
lazy val commonBootstrappedSettings = commonDottySettings ++ NoBloopExport.settings ++ Seq(
// To enable support of scaladoc and language-server projects you need to change this to true and use sbt as your build server
bspEnabled := false,
lazy val commonBootstrappedSettings = commonDottySettings ++ Seq(
// To enable support of scaladoc and language-server projects you need to change this to true
bspEnabled := { if(fullyDisabledProjects(name.value)) false else enableBspAllProjects },
(Compile / unmanagedSourceDirectories) += baseDirectory.value / "src-bootstrapped",

version := dottyVersion,
Expand Down
31 changes: 0 additions & 31 deletions project/NoBloopExport.scala

This file was deleted.

0 comments on commit 24038b8

Please sign in to comment.