Skip to content

Commit 408111c

Browse files
committed
refactor(scala): use new patch_func helper function
1 parent ad0153f commit 408111c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lua/astrocommunity/pack/scala/init.lua

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,16 @@ return {
2323
},
2424
},
2525
opts = function()
26-
local metals = require "metals"
26+
local metals, astrocore = require "metals", require "astrocore"
2727
local astrolsp_avail, astrolsp = pcall(require, "astrolsp")
2828
local user_config = astrolsp_avail and astrolsp.lsp_opts "metals" or {}
29-
if require("astrocore").is_available "nvim-dap" then
30-
local on_attach = user_config.on_attach
31-
user_config.on_attach = function(...)
32-
if type(on_attach) == "function" then on_attach(...) end
29+
if astrocore.is_available "nvim-dap" then
30+
user_config.on_attach = astrocore.patch_func(user_config.on_attach, function(orig, ...)
31+
orig(...)
3332
metals.setup_dap()
34-
end
33+
end)
3534
end
36-
return require("astrocore").extend_tbl(metals.bare_config(), user_config)
35+
return astrocore.extend_tbl(metals.bare_config(), user_config)
3736
end,
3837
config = function(self, opts)
3938
vim.api.nvim_create_autocmd("FileType", {

0 commit comments

Comments
 (0)