Skip to content

Commit

Permalink
feat: implement support for delayed stack loading
Browse files Browse the repository at this point in the history
  • Loading branch information
zobo committed Mar 1, 2022
1 parent c6588ba commit 3f7ac61
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.25.0]

- Implement delayed stack loading with startFrame and levels argument to StackTrace Request

## [1.24.3]

- Fox for broken property traversal #755
- Fix for broken property traversal #755

## [1.24.2]

Expand Down
12 changes: 11 additions & 1 deletion src/phpDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ class PhpDebugSession extends vscode.DebugSession {
},
],
supportTerminateDebuggee: true,
supportsDelayedStackTraceLoading: false,
}
this.sendResponse(response)
}
Expand Down Expand Up @@ -741,7 +742,7 @@ class PhpDebugSession extends vscode.DebugSession {
if (!connection) {
throw new Error('Unknown thread ID')
}
const { stack } = await connection.sendStackGetCommand()
let { stack } = await connection.sendStackGetCommand()
// First delete the old stack trace info ???
// this._stackFrames.clear();
// this._properties.clear();
Expand Down Expand Up @@ -781,7 +782,16 @@ class PhpDebugSession extends vscode.DebugSession {
this._errorStackFrames.set(id, status)
response.body = { stackFrames: [{ id, name, source, line, column: 1 }] }
} else {
const totalFrames = stack.length
if (args.levels !== undefined && args.levels > 0) {
stack = stack.filter(
stackFrame =>
stackFrame.level >= (args.startFrame ?? 0) &&
stackFrame.level < (args.startFrame ?? 0) + args.levels!
)
}
response.body = {
totalFrames,
stackFrames: stack.map((stackFrame): VSCodeDebugProtocol.StackFrame => {
let source: VSCodeDebugProtocol.Source
let line = stackFrame.line
Expand Down

0 comments on commit 3f7ac61

Please sign in to comment.