Skip to main content

Scala

info

You can enable the extra with the :LazyExtras command. Plugins marked as optional will only be configured if they are installed.

Below you can find a list of included plugins and their default settings.

caution

You don't need to copy the default settings to your config. They are only shown here for reference.

nvim-treesitter

opts = { ensure_installed = { "scala" } }

nvim-metals

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",
}

metals_config.on_attach = function(client, bufnr)
-- your on_attach function
require("metals").setup_dap()
end

return metals_config
end

plenary.nvim

opts = nil

nvim-dap (optional)

opts = function()
-- 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