2023-02-11 11:16:16 -08:00
|
|
|
return {
|
|
|
|
"scalameta/nvim-metals",
|
|
|
|
keys = {
|
|
|
|
{ "<leader>ws", "<cmd>lua require'metals'.hover_worksheet()<cr>", desc = "Metals Worksheet" },
|
2023-02-11 11:32:30 -08:00
|
|
|
{
|
|
|
|
"<leader>sm",
|
|
|
|
"<cmd>lua require'telescope'.extensions.metals.commands()<cr>",
|
|
|
|
desc = "Telescope Metals Commands",
|
|
|
|
},
|
2023-02-11 11:16:16 -08:00
|
|
|
},
|
|
|
|
config = function()
|
|
|
|
local metals_config = require("metals").bare_config()
|
2023-02-11 13:59:53 -08:00
|
|
|
metals_config.tvp = {
|
|
|
|
icons = {
|
|
|
|
enabled = true,
|
|
|
|
},
|
|
|
|
}
|
2023-02-11 11:16:16 -08:00
|
|
|
|
|
|
|
metals_config.settings = {
|
2023-02-11 11:59:44 -08:00
|
|
|
serverVersion = "latest.snapshot",
|
2023-02-11 11:16:16 -08:00
|
|
|
showImplicitArguments = true,
|
2023-02-11 13:59:53 -08:00
|
|
|
showImplicitConversionsAndClasses = true,
|
2023-02-11 11:59:44 -08:00
|
|
|
showInferredType = true,
|
|
|
|
bloopSbtAlreadyInstalled = true,
|
2023-02-11 11:16:16 -08:00
|
|
|
excludedPackages = { "akka.actor.typed.javadsl", "com.github.swagger.akka.javadsl" },
|
2023-02-11 13:59:53 -08:00
|
|
|
-- fallbackScalaVersion = "2.13.8",
|
2023-02-11 11:59:44 -08:00
|
|
|
superMethodLensesEnabled = true,
|
|
|
|
javaHome = "/Users/salar/.nix-profile",
|
2023-02-11 11:16:16 -08:00
|
|
|
}
|
|
|
|
|
2023-02-11 11:59:44 -08:00
|
|
|
metals_config.on_attach = function(client, bufnr)
|
2023-02-11 13:59:53 -08:00
|
|
|
vim.keymap.set("n", "<leader>tt", require("metals.tvp").toggle_tree_view)
|
|
|
|
vim.keymap.set("n", "<leader>tr", require("metals.tvp").reveal_in_tree)
|
2023-02-11 11:59:44 -08:00
|
|
|
vim.cmd([[autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()]])
|
|
|
|
vim.cmd([[autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()]])
|
|
|
|
vim.cmd([[autocmd BufEnter,CursorHold,InsertLeave <buffer> lua vim.lsp.codelens.refresh()]])
|
|
|
|
end
|
|
|
|
|
2023-02-11 11:16:16 -08:00
|
|
|
metals_config.init_options.statusBarProvider = "on"
|
|
|
|
|
|
|
|
metals_config.capabilities = require("cmp_nvim_lsp").default_capabilities()
|
|
|
|
|
|
|
|
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()
|
|
|
|
require("metals").initialize_or_attach(metals_config)
|
|
|
|
end,
|
|
|
|
group = nvim_metals_group,
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
}
|