Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lua/dap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ local function select_config_and_run(opts)
end


--- Get the first stopped session.
--- If no session is stopped, it returns the active session or next in sessions.
---@return Session|nil
local function first_stopped_session()
if session and session.stopped_thread_id then
Expand All @@ -420,7 +422,11 @@ local function first_stopped_session()
return s
end
end
return nil
if session then
return session
end
local _, s = next(sessions)
return s
end


Expand Down
6 changes: 6 additions & 0 deletions tests/integration_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,12 @@ describe('dap with fake server', function()
local session = run_and_wait_until_initialized(callable_config, server)
assert.are.same(session.config.x, 1)
end)

it("step does nothing if session is not stopped", function()
local session = run_and_wait_until_initialized(config, server)
dap.step_over()
assert.are.same(session, dap.session())
end)
end)

describe('session disconnect', function()
Expand Down