Skip to content

Commit

Permalink
refactor(scala): use new patch_func helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Sep 19, 2024
1 parent ad0153f commit 408111c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lua/astrocommunity/pack/scala/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,16 @@ return {
},
},
opts = function()
local metals = require "metals"
local metals, astrocore = require "metals", require "astrocore"
local astrolsp_avail, astrolsp = pcall(require, "astrolsp")
local user_config = astrolsp_avail and astrolsp.lsp_opts "metals" or {}
if require("astrocore").is_available "nvim-dap" then
local on_attach = user_config.on_attach
user_config.on_attach = function(...)
if type(on_attach) == "function" then on_attach(...) end
if astrocore.is_available "nvim-dap" then
user_config.on_attach = astrocore.patch_func(user_config.on_attach, function(orig, ...)
orig(...)
metals.setup_dap()
end
end)
end
return require("astrocore").extend_tbl(metals.bare_config(), user_config)
return astrocore.extend_tbl(metals.bare_config(), user_config)
end,
config = function(self, opts)
vim.api.nvim_create_autocmd("FileType", {
Expand Down

0 comments on commit 408111c

Please sign in to comment.