dotfiles/.config/nvim/lua/plugins/scala.lua

35 lines
1.2 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()
metals_config = require('metals').bare_config()
-- Capabilities for completion.
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
metals_config.settings = {
showImplicitArguments = true,
showInferredType = true
}
-- 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').update_capabilities(capabilities)
require('metals').initialize_or_attach(metals_config)
end,
group = nvim_metals_group,
})