Always set startFrame in stackTrace request

Relates to https://github.com/mfussenegger/nvim-dap/discussions/869#discussioncomment-10058258
This commit is contained in:
Mathias Fussenegger 2024-08-09 14:36:09 +02:00 committed by Mathias Fußenegger
parent 7bf34e0917
commit 2b428ff263
2 changed files with 37 additions and 1 deletions

View file

@ -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

View file

@ -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