
Finally, build tools other than sbt may implement the BSP protocol, and will be available to use in IntelliJ without having to add custom support.
INTELLIJ SCALA CODE
In addition, the build on save feature enables a much faster feedback whether your code really compiles, especially since IntelliJ may sometimes incorrectly mark perfectly compiling code with red squigglies or other types of errors. The major benefit of using BSP instead of importing the sbt project directly is the fact that the server will run constantly in the background, allowing IntelliJ to communicate via the protocol instead of launching external processes. For more information, I recommend this blog post from Justin Kaeser of the Scala plugin team at JetBrains. By exposing a common protocol, the IDE (the BSP client) can speak to the build tool (the BSP server) directly, resulting in much faster and more fine-grained incremental compilation, as well as receiving the output payload back via the protocol. sbt or mvn) as an external process, read its output, and render the result accordingly. Traditionally, the editor would have to execute the build tool (e.g. The BSP makes the job of integrating build tooling into IDEs easier. It derives from LSP (Language Server Protocol), a Microsoft specification for building rich editor tooling for various programming languages, such as Scala (via Metals) or Haskell (via haskell-lsp). BackgroundīSP, or the Build Server Protocol, is a specification for abstracting over build tools, designed in collaboration between JetBrains and the Scala Center.
INTELLIJ SCALA HOW TO
This post is a step-by-step tutorial on how to use and get the most out of the BSP support in IntelliJ. I am grateful to sbt maintainer Adrien Piquerez of Scala Center and Justin Kaeser of JetBrains, who implemented the BSP support in IntelliJ for their hard work and great help!

I’ve recently contributed a couple of fixes to sbt’s implementation of BSP, adding a few missing pieces, allowing improved support in IntelliJ using sbt’s native BSP server.

I’ve been using the BSP support in IntelliJ for over 6 months now, and while the experience wasn’t always smooth, it’s definitely worth considering switching to BSP over sbt.
