Skip to content

Commit

Permalink
fix(dap_manual): removed preload of DAP strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
HeavyPunk committed Nov 19, 2024
1 parent 3f37e73 commit 1cd4e64
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions lua/neotest-golang/features/dap/init.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
--- DAP setup related functions.

local options = require("neotest-golang.options")
local dap_manual = require("neotest-golang.features.dap.dap_manual")
local dap_go = require("neotest-golang.features.dap.dap_go")

local M = {}

Expand All @@ -14,32 +12,33 @@ local function is_dap_manual_enabled()
return dap_manual_enabled
end

---@param cwd string
function M.setup_debugging(cwd)
local function get_dap_implementation()
local dap_impl
if is_dap_manual_enabled() then
dap_manual.setup_debugging(cwd)
dap_impl = require("neotest-golang.features.dap.dap_manual")
else
dap_go.setup_debugging(cwd)
dap_impl = require("neotest-golang.features.dap.dap_go")
end
return dap_impl
end

---@param cwd string
function M.setup_debugging(cwd)
local dap_impl = get_dap_implementation()
dap_impl.setup_debugging(cwd)
end

--- @param test_path string
--- @param test_name_regex string?
--- @return table | nil
function M.get_dap_config(test_path, test_name_regex)
if is_dap_manual_enabled() then
return dap_manual.get_dap_config(test_path, test_name_regex)
else
return dap_go.get_dap_config(test_path, test_name_regex)
end
local dap_impl = get_dap_implementation()
return dap_impl.get_dap_config(test_path, test_name_regex)
end

function M.assert_dap_prerequisites()
if is_dap_manual_enabled() then
dap_manual.assert_dap_prerequisites()
else
dap_go.assert_dap_prerequisites()
end
local dap_impl = get_dap_implementation()
dap_impl.assert_dap_prerequisites()
end

return M

0 comments on commit 1cd4e64

Please sign in to comment.