You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blog/_posts/2020-10-27-bsp-in-sbt.md
+27-10Lines changed: 27 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,28 @@ by: Adrien Piquerez, Scala Center
5
5
title: BSP Support in sbt 1.4
6
6
---
7
7
8
-
The Build Server Protocol (BSP) is the result of a fruitful collaboration between the IntelliJ Scala team at JetBrains and the Scala Center at EPFL. It is a standard communication protocol that describes the interaction between IDEs and build tools. You can find its specification in the [BSP website][bsp-website].
8
+
sbt is a prominent tool of the Scala ecosystem. Yet it is poorly integrated in our IDEs and code editors, which are used to relying on internals or third parties to perform operations like compiling, running and testing.
9
9
10
-
The first version of BSP was released in June 2018. It has since been adopted by some major players of the Scala tooling ecosystem, among which IntelliJ Idea, Metals and Bloop.
10
+
From this lack of integration derives a number of inconveniences:
11
+
- Duplicated compilation times between sbt and the IDE
12
+
- False compiler errors on the IDE
13
+
- Outdated dependencies causing run-time failures
14
+
- Conflicting Java versions
11
15
12
-
Support of BSP in sbt is a [Scala Center Advisory Board Proposal][proposal], dated January 2020, initiated by [Justin Kaeser](https://github.com/jastice) from [JetBrains](https://www.jetbrains.com/)and submitted by [Bill Venners](https://github.com/bvenners) as a community representative.
16
+
We, at the Scala Center, are dedicated to improving the tooling that benefits all Scala users. We collaborated with [JetBrains](https://www.jetbrains.com/)on designing the [Build Server Protocol][bsp-website] (BSP), a communication protocol between IDEs and build tools. It has since been adopted by some major players of the Scala tooling ecosystem, among which IntelliJ Idea, Metals and Bloop. Yet it was not supported by sbt until recently.
13
17
14
-
We, at the Scala Center, had the chance to closely collaborate with [Eugene Yokota](http://eed3si9n.com/) on this proposal and we are now proud to announce that BSP is supported by [sbt 1.4.0][release-note]. In the present post we outline the motivation behind BSP in sbt and the following outcome.
18
+
Today we are proud to announce that support of BSP has been shipped into [sbt 1.4.0][release-note].
19
+
20
+
As we will see in more details, BSP in sbt improves the integration of sbt inside IDEs and code editors. It provides the user with a unified working environment that is:
21
+
- Optimal in terms of compilation speed and reliability
22
+
- Centralized around the sbt build definition
23
+
- Highly customizable, by benefitting from the sbt task graph
24
+
25
+
You can already try using sbt as the build server in IntelliJ Idea or Metals by following the instructions in this [Scala contributors post][instructions] or in the [sbt 1.4.0 release note][release-note]. _(Metals integration will soon become much smoother thanks to [this PR](https://github.com/scalameta/metals/pull/2154) by [Chris Kipp](https://github.com/ckipp01))_
26
+
27
+
## Background
28
+
29
+
Support of BSP in sbt is a [Scala Center Advisory Board Proposal][proposal], dated January 2020, initiated by [Justin Kaeser](https://github.com/jastice) from [JetBrains](https://www.jetbrains.com/) and submitted by [Bill Venners](https://github.com/bvenners) as a community representative. We, at the Scala Center, had the chance to closely collaborate with [Eugene Yokota](http://eed3si9n.com/) on this proposal.
15
30
16
31
## Motivation
17
32
@@ -33,7 +48,9 @@ IntelliJ Idea is also a build client, but it does not rely on a language server.
33
48
34
49
With the recent built-in support of BSP in sbt, it is going to be possible for Metals and IntelliJ to connect to the sbt server and communicate with it directly. This solution is an alternative to the current status quo of using Bloop as a third-party BSP server.
35
50
36
-
Bloop still offers many advantages compared to sbt server. It can serve several build clients, on different projects, and run the requests concurrently. It also supports DAP, the Debug Adapter Protocol, which provides code editors with the ability to debug applications and evaluate code at runtime.
51
+
Bloop still offers some advantages compared to sbt server. It can serve several build clients, on different projects, and run the requests concurrently. It also supports DAP, the Debug Adapter Protocol, which provides code editors with the ability to debug applications and evaluate code at runtime.
52
+
53
+
In contrast, by using sbt as the build server, you avoid potential inconsistencies, you spare duplicated compilation times, and you benefit from the customization of your build inside your IDE.
37
54
38
55
Choosing Bloop or sbt as the build server depends on the project you are working on and the developer experience you are looking for. In the following paragraph we describe the main characteristics of using sbt as a build server.
39
56
@@ -133,11 +150,11 @@ The previous example gives us a glimpse at the possibilities opened by BSP in sb
133
150
BSP support in sbt is a major milestone in the adoption of BSP in the Scala ecosystem. We hope that it will ease the integration of sbt for the teams working on IDEs and language servers.
134
151
135
152
We also hope that it will improve the experience of the large group of all sbt users by offering them a unified working environment that meets their needs:
136
-
- An optimal workflow for developing, compiling, testing and releasing their project.
137
-
- A centralized source of configuration, that is the sbt build definition.
138
-
- A high level of customization that is compatible with all environments.
153
+
- An optimal workflow for developing, compiling, testing and releasing their project.
154
+
- A centralized source of configuration, that is the sbt build definition.
155
+
- A high level of customization that is compatible with all environments.
139
156
140
-
The BSP implementation is very fresh in sbt 1.4.0. No doubt that the two main BSP clients, Metals and IntelliJ Idea, need some time to polish things around it. You are nonetheless very much encouraged to give it a try by following the instructions in this [Scala contributors post](https://contributors.scala-lang.org/t/build-server-protocol-in-sbt/4234/27) or in the [sbt 1.4.0 release note][release-note].
157
+
The BSP implementation is very fresh in sbt 1.4.0. No doubt that we will need some time to round the corners. You are nonetheless very much encouraged to give it a try by following the instructions in this [Scala contributors post][instructions] or in the [sbt 1.4.0 release note][release-note].
141
158
142
159
## Links and Additional Resources
143
160
@@ -147,7 +164,7 @@ The BSP implementation is very fresh in sbt 1.4.0. No doubt that the two main BS
147
164
-[The Scala Center Advisory Board proposal][proposal]
0 commit comments