scalameta/nvim-metals

website github github
pluginlspneovim-0.5
stars 331
issues 19
subscribers 25
forks 64
CREATED

2020-04-26

UPDATED

2 days ago


nvim-metals logo

nvim-metals

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.[^no-lspconfig] You can see all the available features here.

Prerequisites

  • Before you get started you need to ensure that you are using nvim v.0.9.0 or newer. If you're still on v0.8.x then you'll want to target the v0.8.x tag.
  • Ensure Coursier is installed locally.[^coursier]
  • Ensure that you have all the LSP mappings for the core functionality you want setup.[^mappings]
  • Ensure plenary.nvim is installed.[^plenary]
  • Subscribe to this discussion which will notify you of any breaking changes.
  • Unfamiliar with Lua and Neovim? Check out the great :h lua-guide.

Installation

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.[^no-lspconfig]

Example if using packer:

use({'scalameta/nvim-metals', requires = { "nvim-lua/plenary.nvim" }})

Getting started

Settings and Commands

To view all of the available commands, check out :help metals-commands in the help docs. Similarly, to see the available configuration settings check out :help metals-settings.

Integrations

To see the full details on the available configurations, checkout out :help metals-integrations. The currently available integrations are:

[^no-lspconfig]: If you're familiar with nvim and LSP you'll probably know of nvim-lspconfig which also has a Metals configuration. Note that this is a very minimal version with no specific Metals commands and no Metals extensions. You can see more info on this here. DO NOT try to use Metals both with nvim-lspconfig and with nvim-metals as stuff will not work right. [^coursier]: nvim-metals uses Coursier to download and update Metals. NOTE: On Windows, you should run coursier or cs.exe once from the command line as this is how it will install itself. Once this is done you should add C:\Users\YOURNAME\AppData\Coursier\data\bin to your path. To verify that it is properly installed you can run cs --help from a new shell. [^mappings]: By default methods for things like goto definition, find references, etc are there, but not automatically mapped. You can find a minimal example configuration here. [^plenary]: You're more than likely already relying on for other plugins. However, make sure to also have this installed as Metals uses it for things like Jobs, popups, and paths.