diff --git a/lua/dap/protocol.lua b/lua/dap/protocol.lua index 0128bf5e..7662a81f 100644 --- a/lua/dap/protocol.lua +++ b/lua/dap/protocol.lua @@ -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 diff --git a/lua/dap/session.lua b/lua/dap/session.lua index a717bf8e..10371e34 100644 --- a/lua/dap/session.lua +++ b/lua/dap/session.lua @@ -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