dotfiles/.config/nvim/lua/plugins/metals.lua

33 lines
1.1 KiB
Lua

-- Note that Metals _does not use nvim-lspconfig_.
-- It still uses the nvim LSP, however.
-- Autocmd that will actually be in charging of starting the whole thing
local nvim_metals_group = vim.api.nvim_create_augroup(
'nvim-metals',
{ clear = true }
)
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'scala', 'sbt', 'java' },
callback = function()
local metals_config = require('metals').bare_config()
metals_config.settings = {
-- Comment this out to use latest stable.
serverVersion = "latest.snapshot",
showImplicitArguments = true,
showInferredType = true,
superMethodLensesEnabled = false
}
-- This is a tricky option and _nothing_ will show up unless...
-- "However, to enable this you _must_ have the metals status shown in your
-- status bar somehow."
metals_config.init_options.statusBarProvider = 'on'
metals_config.capabilities = require('cmp_nvim_lsp').default_capabilities()
require('metals').initialize_or_attach(metals_config)
end,
group = nvim_metals_group,
})