mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 06:39:14 +00:00
nvim: refactor scala configuration
This commit is contained in:
parent
83a83630db
commit
35787ab423
4 changed files with 26 additions and 43 deletions
|
|
@ -143,46 +143,3 @@ vim.api.nvim_create_autocmd("FileType", {
|
|||
callback = function() require("jdtls").start_or_attach(config) end,
|
||||
group = jdtls_group,
|
||||
})
|
||||
|
||||
-- Scala
|
||||
local metals = require("metals")
|
||||
local metals_config = metals.bare_config()
|
||||
metals_config.capabilities = mylsp.capabilities
|
||||
metals_config.settings.useGlobalExecutable = true
|
||||
|
||||
require("dap").configurations.scala = {
|
||||
{
|
||||
type = "scala",
|
||||
request = "launch",
|
||||
name = "RunOrTest",
|
||||
metals = { runType = "runOrTestFile" },
|
||||
},
|
||||
{
|
||||
type = "scala",
|
||||
request = "launch",
|
||||
name = "Test Target",
|
||||
metals = { runType = "testTarget" },
|
||||
},
|
||||
}
|
||||
|
||||
metals_config.on_attach = function(client, bufnr)
|
||||
metals.setup_dap()
|
||||
|
||||
map("n", "<leader>ws", metals.hover_worksheet)
|
||||
|
||||
map("n", "<leader>dc", require("dap").continue)
|
||||
map("n", "<leader>dr", require("dap").repl.toggle)
|
||||
map("n", "<leader>dK", require("dap.ui.widgets").hover)
|
||||
map("n", "<leader>dt", require("dap").toggle_breakpoint)
|
||||
map("n", "<leader>dso", require("dap").step_over)
|
||||
map("n", "<leader>dsi", require("dap").step_into)
|
||||
map("n", "<leader>dl", require("dap").run_last)
|
||||
|
||||
mylsp.on_attach(client, bufnr)
|
||||
end
|
||||
local nvim_metals_group = vim.api.nvim_create_augroup("nvim-metals", { clear = true })
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "scala", "sbt" },
|
||||
callback = function() require("metals").initialize_or_attach(metals_config) end,
|
||||
group = nvim_metals_group,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue