Skip to content

Commit 72684a4

Browse files
committed
Set session parent for executable adapter in startDebugging
1 parent fd291e9 commit 72684a4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lua/dap/session.lua

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,11 +1018,16 @@ local function start_debugging(self, request)
10181018
return
10191019
end
10201020

1021-
if adapter.type == "executable" then
1022-
local session = Session:spawn(adapter, opts)
1021+
local function on_child_session(session)
1022+
session.parent = self
10231023
self.children[session.id] = session
10241024
session:initialize(config)
10251025
self:response(request, {success = true})
1026+
end
1027+
1028+
if adapter.type == "executable" then
1029+
local session = Session:spawn(adapter, opts)
1030+
on_child_session(session)
10261031
elseif adapter.type == "server" then
10271032
local session
10281033
session = Session:connect(adapter, opts, function(err)
@@ -1034,10 +1039,7 @@ local function start_debugging(self, request)
10341039
err
10351040
), vim.log.levels.WARN)
10361041
elseif session then
1037-
session.parent = self
1038-
self.children[session.id] = session
1039-
session:initialize(config)
1040-
self:response(request, {success = true})
1042+
on_child_session(session)
10411043
end
10421044
end)
10431045
end

0 commit comments

Comments
 (0)