Skip to content

Commit

Permalink
Revert required fields
Browse files Browse the repository at this point in the history
The extension now decides if it should enable the remote debugging if a
port is defined in the user configuration.
  • Loading branch information
cyb3rd4d committed Jul 31, 2024
1 parent 71361a9 commit d897448
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions lua/dap-go.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,17 @@ local function setup_delve_adapter(dap, config)
}

dap.adapters.go = function(callback, client_config)
local required_fields = {
"mode",
"port",
"host",
}

for _, field in ipairs(required_fields) do
if client_config[field] == nil then
vim.notify(string.format("missing DAP config key %s", field), vim.log.levels.ERROR)
return
end
end

if client_config.mode ~= "remote" then
if client_config.port == nil then
callback(delve_config)
return
end

local listener_addr = client_config.host .. ":" .. client_config.port
local host = client_config.host
if host == nil then
host = "127.0.0.1"
end

local listener_addr = host .. ":" .. client_config.port
delve_config.port = client_config.port
delve_config.executable.args = { "dap", "-l", listener_addr }

Expand Down

0 comments on commit d897448

Please sign in to comment.