2024-03-07 11:54:16 +01:00
|
|
|
return {
|
2024-05-18 14:39:20 +02:00
|
|
|
recommended = function()
|
|
|
|
return LazyVim.extras.wants({
|
|
|
|
ft = "scala",
|
|
|
|
root = { "build.sbt", "build.sc", "build.gradle", "pom.xml" },
|
|
|
|
})
|
|
|
|
end,
|
2024-03-07 11:54:16 +01:00
|
|
|
{
|
2024-06-05 15:07:13 +09:00
|
|
|
"nvim-treesitter/nvim-treesitter",
|
2024-06-07 09:03:59 +02:00
|
|
|
opts = { ensure_installed = { "scala" } },
|
2024-03-07 11:54:16 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"scalameta/nvim-metals",
|
2025-03-04 13:35:58 -06:00
|
|
|
dependencies = {
|
|
|
|
"nvim-lua/plenary.nvim",
|
|
|
|
},
|
|
|
|
keys = {
|
|
|
|
{
|
|
|
|
"<leader>me",
|
|
|
|
function()
|
|
|
|
require("telescope").extensions.metals.commands()
|
|
|
|
end,
|
|
|
|
desc = "Metals commands",
|
2024-06-05 15:07:13 +09:00
|
|
|
},
|
2025-03-04 13:35:58 -06:00
|
|
|
{
|
|
|
|
"<leader>mc",
|
|
|
|
function()
|
|
|
|
require("metals").compile_cascade()
|
|
|
|
end,
|
|
|
|
desc = "Metals compile cascade",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"<leader>mh",
|
|
|
|
function()
|
|
|
|
require("metals").hover_worksheet()
|
2024-03-07 11:54:16 +01:00
|
|
|
end,
|
2025-03-04 13:35:58 -06:00
|
|
|
desc = "Metals hover worksheet",
|
2024-06-05 15:07:13 +09:00
|
|
|
},
|
|
|
|
},
|
2025-03-04 13:35:58 -06:00
|
|
|
ft = { "scala", "sbt", "java" },
|
|
|
|
opts = function()
|
|
|
|
local metals_config = require("metals").bare_config()
|
|
|
|
|
|
|
|
metals_config.init_options.statusBarProvider = "off"
|
|
|
|
|
|
|
|
metals_config.settings = {
|
|
|
|
verboseCompilation = true,
|
|
|
|
showImplicitArguments = true,
|
|
|
|
showImplicitConversionsAndClasses = true,
|
|
|
|
showInferredType = true,
|
|
|
|
superMethodLensesEnabled = true,
|
|
|
|
excludedPackages = {
|
|
|
|
"akka.actor.typed.javadsl",
|
|
|
|
"org.apache.pekko.actor.typed.javadsl",
|
|
|
|
"com.github.swagger.akka.javadsl",
|
|
|
|
},
|
|
|
|
testUserInterface = "Test Explorer",
|
|
|
|
}
|
2024-03-07 11:54:16 +01:00
|
|
|
|
2025-03-04 13:35:58 -06:00
|
|
|
metals_config.on_attach = function(client, bufnr)
|
|
|
|
-- your on_attach function
|
|
|
|
require("metals").setup_dap()
|
|
|
|
end
|
|
|
|
|
|
|
|
return metals_config
|
|
|
|
end,
|
|
|
|
config = function(self, metals_config)
|
|
|
|
local nvim_metals_group = vim.api.nvim_create_augroup("nvim-metals", { clear = true })
|
|
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
|
|
pattern = self.ft,
|
|
|
|
callback = function()
|
|
|
|
require("metals").initialize_or_attach(metals_config)
|
|
|
|
end,
|
|
|
|
group = nvim_metals_group,
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
},
|
2024-06-05 15:07:13 +09:00
|
|
|
{
|
|
|
|
"mfussenegger/nvim-dap",
|
|
|
|
optional = true,
|
|
|
|
opts = function()
|
2024-03-07 11:54:16 +01:00
|
|
|
-- Debug settings
|
|
|
|
local dap = require("dap")
|
|
|
|
dap.configurations.scala = {
|
|
|
|
{
|
|
|
|
type = "scala",
|
|
|
|
request = "launch",
|
|
|
|
name = "RunOrTest",
|
|
|
|
metals = {
|
|
|
|
runType = "runOrTestFile",
|
|
|
|
--args = { "firstArg", "secondArg", "thirdArg" }, -- here just as an example
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type = "scala",
|
|
|
|
request = "launch",
|
|
|
|
name = "Test Target",
|
|
|
|
metals = {
|
|
|
|
runType = "testTarget",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
}
|