Metals

Metals is the Scala language server most editors use for completion, diagnostics, and go-to-definition. It does not read histos.scala itself. It asks a build server, over BSP (the Build Server Protocol), for the targets, the classpath, and the compiler diagnostics.

Histos is that build server. When you import the build, Metals reads .bsp/histos.json in the project and starts the command listed there. That command is histos bsp. histos update rewrites the file from the pin, so after you change Histos versions the editor starts the Histos you just pinned.

What you can do after import

The server calls itself histos and speaks BSP 2.2. After import, Metals can list targets, find sources, read scalac options, compile, and ask for main classes and test classes. Run and test from the editor use the JVM run and test environments Histos reports. Diagnostics are pushed as they are produced, so a compile error shows up in the editor without a separate command.

histos.bsp.Bsp.BspVersion
val BspVersion: String = "2.2.0"
histos.bsp.Bsp.ServerName
val ServerName: String = "histos"

One editor target is one cell

A target is one cell: one module, one Scala version, one platform, and either main sources or test sources. A module you build for the JVM and for Scala.js shows up as separate targets. histos.scala is a target of its own, so a mistake in the build file is reported like any other compile error.

histos.Platform.token
def token: String = this match
    case Jvm    => "jvm"
    case Js     => "js"
    case Native => "native"

It stays on the JVM

histos bsp does not go through the native client. The editor needs a long-lived process that speaks the protocol, and that process is the JVM server. You do not start it by hand in normal use. Metals starts it from .bsp/histos.json. You can run histos bsp yourself when you are debugging the connection.

histos.cli.Help.entries
val entries: List[Entry] = List(
    Entry(
      "version",
      "info",
      "histos version",
      "Print the toolchain this command runs and, with a server up, that server's version.",
    ),
    Entry("help", "info", "histos help [command]", "List commands, or show one command."),
    Entry(
      "completion",
      "info",
      "histos completion [install] [zsh|bash]",
      "Print the completion script for this shell. zsh or bash names the shell. install writes it under ~/.histos/completions and prints the rc line. Project, module, and plugin names are offered only while a server is already listening.",
    ),
    Entry("--explain", "info", "histos --explain <check-id>", "Print one check."),
    Entry(
      "--color",
      "info",
      "histos [--color | --no-color] [--truecolor | --no-truecolor] <command>",
      "Color is on when stdout is a terminal and NO_COLOR is unset or empty. --color forces it on. --no-color forces it off. The last flag wins. --truecolor sends 24-bit color. --no-truecolor stops at the 256-color cube. --truecolor does not turn color on. A pipe stays plain unless --color is set.",

…