nvim-metals is a Lua plugin built to provide a better experience while using
Metals, the Scala Language Server, with Neovim's built-in LSP
support. This plugin provides the
necessary commands you'll need to develop with nvim and Metals. This extension
also implements many of the custom Metals LSP extensions that will give you a
much richer experience than just using Metals with the default
nvim-lspconfig setup, as well as
automatically setting all of the correct init_options
.
NOTE: Keep in mind that the level of support is rapidly changing, so expect stuff to change without warning.
- Before you get started you need to ensure that you have the nightly/development
build of Neovim. LSP support hasn't landed in stable yet. You can find
instructions for how to do this for your OS
here. It's best to
re-build often as LSP support is changing daily. The easiest way to ensure
you're on nightly is to to do a
nvim --version
. If you see anythingv0.4.x
then it didn't work. You're looking forv0.5.x
. NOTE: Make sure the version you're using includes commit #6e660d4 to ensurewindow/showMessageRequest
s work. - Ensure Coursier is installed
on your machine.
nvim-metals
uses Coursier to download and update Metals. - Remove
F
fromshortmess
.set shortmess-=F
NOTE: Without doing this, autocommands that deal with filetypes prohibit messages from being shown... and since we heavily rely on this, this must be set. - Ensure that you have mappings created for functionality that you desire. By
default methods for things like goto definition, find references, etc are
there, but not automatically mapped. You can find both minimal mixed
Vimscript/Lua and pure Lua example configurations for
nvim-metals
here.
NOTE: This plugin works without needing to install
neovim/nvim-lspconfig. If you have
it installed for other languages, that's not a problem, but make sure you do not
have Metals configured through nvim-lspconfig
while using this plugin. If you
have nvim/lsp-config
registered with nvim-lspconfig
, you'll want to remove
it.
nvim-metals
is just a plugin installed like any other Neovim plugin. For
example if using packer
:
use 'scalameta/nvim-metals'
To get started with nvim-metals
, please read :help nvim-metals
.
This will give you a thorough overview of the setup and settings.
To view all of the available commands, check out :help metals-commands
in the
help docs. Similarly, to see the available configuration options, check out
:help metals-options
, and :help metals-settings
for settings.
NOTE: You can find an example of a minimal configuration showing how to set various settings and options here.