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

35 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()
-- Capabilities for completion.
local capabilities = require('cmp_nvim_lsp').default_capabilities()
metals_config.settings = {
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 = capabilities
require('metals').initialize_or_attach(metals_config)
end,
group = nvim_metals_group,
})