Importing a build

Open Sublime in the base directory of an sbt build. Run the "Enable Language
Server in project" command.

This starts the Metal language server but no functionality will work because the
build has not been imported. The first time you enable Language Server in a
project, it prompts you to "Import changes". This step is required for compile
errors and goto definition to work and while it is running, no Metals
functionality will work.

This step can take a long time, especially the first time you run it in a new
workspace. The exact time depends on the complexity of the build and if library
dependencies are cached or need to be downloaded. For example, this step can
take everything from 10 seconds in small cached builds up to 10-15 minutes in
large uncached builds.

For more detailed information about what is happening behind the scenes during
sbt bloopInstall:

tail -f .metals/metals.log

Once the import step completes, compilation starts for your open *.scala
files. Once the sources have compiled successfully, you can navigate the the
sources with "Goto definition" by pressing F12.

Find symbol references

The default key binding is shift+F12. If you use vim-binding, you need to be
in insert-mode.

Goto symbol in workspace

You can search for symbols in dependency source using the command palette

Manually trigger build import

You can configure a custom command "Metals: Import Build" to manually trigger
build import when changing build.sbt. To learn about Sublime Text commands see
here.

Update the contents of your *.sublime-commands file to include the following
command.

Known issues

The Sublime Text client uses an alert window for window/showMessage that
prevents you from editing code so Metals uses window/logMessage instead.

Gitignore .metals/ and .bloop/

The Metals server places logs and other files in the .metals/ directory. The
Bloop compile server places logs and compilation artifacts in the .bloop
directory. It's recommended to ignore these directories from version control
systems like git.