( The Scala Center team is dedicated to providing regular and transparent community updates about project plans & progress. In this forum we created a new topic category to allow quicker orientation going forward: “Scala Center Updates”. Even though all feedback is welcome, we keep the right to make executive decisions about projects we lead. Overview of all our activities can always be found at https://scala.epfl.ch/records.html )
This project was initiated by the community members and voted on during the Scala Center Q1 2020 Advisory Board as per Scala Center Proposal 023
Identified Problem
The integration of IDEs (Metals and IntelliJ) with sbt rely on the injection of custom plugins into the user project configuration. This approach is burdened by a number of drawbacks:
- the user experience is not optimal
- the custom plugin can have bad interactions with other plugins
- the build requests from the IDE do not run the full sbt task graph (including source generation) which sometimes cause the IDE to be out-of-sync with sbt.
Example: running sbt clean
will cause Metals to go off the rails.
- the maintenance effort is multiplied by the number of plugins
Proposed Solution
The proposed solution is to implement BSP in sbt server. This solution would solve the identified problems. Additionally it will push the adoption of BSP in the Scala ecosystem one step further.
Identified Risks
The synchronous nature of sbt could deteriorate the IDE user experience:
- It would be impossible for the IDE to compile when the sbt shell is running another task
- Running the sbt watch command would block the IDE indefinitely. In other words, it won’t be possible to use the watch command while working in a IDE.
Third parties (in collaboration with)
The third parties involved in this project are:
- sbt maintainers
- Metals maintainers
- BSP and Bloop maintainers
- JetBrains and the IntelliJ Scala plugin team
The Scala Center team is actively involved in collaborating with all interested parties during the development of this project.
Scala Center proposed roadmap
May 2020
-
Take over @eed3si9n initial draft for BSP support in sbt and implement the minimum viable set of BSP endpoints in sbt core. This implementation will be delivered to the community in an experimental sbt version.
-
Elaborate on the integration of the sbt BSP server in Metals and/or IntelliJ Idea to assess the viability of the solution and to collect community feedback.
June 2020
-
Implement the BSP server discovery standard in sbt so that the integration in Metals and IntelliJ become trivial.
-
Depending on the community feedback the Scala Center will push forward to ship the full BSP implementation in sbt 1.4.0.
July 2020
-
Implement in Metals an option to start the sbt server if it is not yet started. This option will be an alternative solution to using Bloop with sbt-bloop.
-
In case of a poor user-experience, elaborate on a better integration of Bloop in sbt via delegation of compile, test and run requests. In this solution, sbt would be a BSP server but the actual compilation and execution would be serviced by Bloop.
From August 2020
-
Maintain the BSP implementation in sbt and support the eventual BSP evolution.
-
Support the community in integrating other tools with the sbt server via BSP.