IDE Support

To support various IDEs and Language Servers, Mill supports the Build Server Protocol in version 2.0.0 and has a built-in BSP server.

In addition to BSP, Mill also supports IntelliJ IDEA project configuration generation directly.

Build Server Protocol (BSP)

To install a BSP connection file .bsp/mill-bsp.json, run:

mill mill.bsp.BSP/install

Working known clients of the BSP server are IntelliJ IDEA and Metals.

You can fine control some BSP server options by specifying command options:

Option

Description

--jobs n

Use n threads in parallel to run tasks. A value of 0 means use as much threads as the system has cpu cores.

Using Metals

When using Metals by default Bloop will be used as your build server unless you explicitly choose Mill. When in a Mill workspace use the "Switch Build Server" command from Metals which will allow you to switch to using Mill as your build server. If no .bsp/mill-bsp.json file exists, Metals will automatically create it for you and then connect to Mill.

Metals is relying on SemanticDB to enable many of its features. Mill BSP now also supports to provide this SemanticDB data, when the BSP client (like Metals) requests it.

As of writing this, Metals 0.11.8 is the latest available version, which is not able to detect the fact, that Mill is already providing SemanticDB data. As a consequence, it reports missing SemanticDB data, although some SemanticDB-based features are already working. This may be fixed eventually in a future release of Metals.

Updating older setups

In the past, we provided SemanticDB support via mill.scalalib.bsp.ScalaMetalsSupport trait, which had to be mixed-in to your Scala modules. This is no longer needed and deprecated. You should remove these mix-ins. ScalaMetalsSupport trait is now deprecated and will be removed in the future.

Using Bloop (standalone BSP server)

If you wish to use Bloop as your build server (it is the default metals BSP implementation) with metals / vscode, consider using the mill bloop plugin.

This is preferred to the instructions (currently) on the bloop website.

IntelliJ Support

To generate IntelliJ IDEA project files into .idea/, run:

mill mill.scalalib.GenIdea/idea