Skip to content

Commit

Permalink
Always set startFrame in stackTrace request
Browse files Browse the repository at this point in the history
  • Loading branch information
mfussenegger committed Aug 9, 2024
1 parent 7bf34e0 commit 12d2902
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
31 changes: 31 additions & 0 deletions lua/dap/protocol.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,37 @@
---@field presentationHint nil|"normal"|"label"|"subtle";
---@field scopes? dap.Scope[] Not part of spec; added by nvim-dap


---@class dap.StackFrameFormat : dap.ValueFormat
--- Displays parameters for the stack frame.
--- @field parameters? boolean
---
--- Displays the types of parameters for the stack frame.
--- @field parameterTypes? boolean
---
--- Displays the names of parameters for the stack frame.
--- @field parameterNames? boolean
---
--- Displays the values of parameters for the stack frame.
--- @field parameterValues? boolean
---
--- Displays the line number of the stack frame.
--- @field line? boolean
---
--- Displays the module of the stack frame.
--- @field module? boolean
---
--- Includes all stack frames, including those the debug adapter might
--- otherwise hide.
--- @field includeAll? boolean


---@class dap.StackTraceArguments
---@field threadId number thread for which to retrieve the stackTrace
---@field startFrame? number index of the first frame to return. If omitted frames start at 0
---@field levels? number maximum number of frames to return. If absent or 0 all frames are returned
---@field format? dap.StackFrameFormat only honored with supportsValueFormattingOptions capability

---@class dap.StackTraceResponse
---@field stackFrames dap.StackFrame[]
---@field totalFrames? number
Expand Down
7 changes: 6 additions & 1 deletion lua/dap/session.lua
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,12 @@ function Session:event_stopped(stopped)
local thread = self.threads[stopped.threadId]
assert(thread, 'Thread not found: ' .. stopped.threadId)

local err, response = self:request('stackTrace', { threadId = stopped.threadId; })
---@type dap.StackTraceArguments
local params = {
startFrame = 0,
threadId = stopped.threadId
}
local err, response = self:request('stackTrace', params)
if err then
utils.notify('Error retrieving stack traces: ' .. utils.fmt_error(err), vim.log.levels.ERROR)
return
Expand Down

0 comments on commit 12d2902

Please sign in to comment.