Skip to content

Commit f64d05b

Browse files
committed
fix: reset "stopOnEntry" after first use to show correct pause reason (#478)
* Reset "stopOnEntry" after first use to show correct pause reason. If "stopOnEntry" is enabled the pause reason will always be "Paused on entry" event if it's the result of a step operation or breakpoint. Resetting the "stopOnEntry" after first use solves the issue. The flag is not used anywhere else. * Do not use _args.stopOnEntry since it should be regarded immutable and is set only on every adapter run. Reconnecting to adapter would cause issues. Always reset _hasStoppedOnEntry flag just before calling the step into operation.
1 parent 4e1e1fe commit f64d05b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/phpDebug.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ class PhpDebugSession extends vscode.DebugSession {
140140
/** A map from unique VS Code variable IDs to XDebug eval result properties, because property children returned from eval commands are always inlined */
141141
private _evalResultProperties = new Map<number, xdebug.EvalResultProperty>()
142142

143+
/** A flag to indicate that the adapter has already processed the stopOnEntry step request */
144+
private _hasStoppedOnEntry = false
145+
143146
public constructor() {
144147
super()
145148
this.setDebuggerColumnsStartAt1(true)
@@ -363,8 +366,9 @@ class PhpDebugSession extends vscode.DebugSession {
363366
}
364367
stoppedEventReason = 'exception'
365368
exceptionText = response.exception.name + ': ' + response.exception.message // this seems to be ignored currently by VS Code
366-
} else if (this._args.stopOnEntry) {
369+
} else if (this._args.stopOnEntry && !this._hasStoppedOnEntry) {
367370
stoppedEventReason = 'entry'
371+
this._hasStoppedOnEntry = true
368372
} else if (response.command.indexOf('step') === 0) {
369373
stoppedEventReason = 'step'
370374
} else {
@@ -623,6 +627,7 @@ class PhpDebugSession extends vscode.DebugSession {
623627
// either tell VS Code we stopped on entry or run the script
624628
if (this._args.stopOnEntry) {
625629
// do one step to the first statement
630+
this._hasStoppedOnEntry = false
626631
return connection.sendStepIntoCommand()
627632
} else {
628633
return connection.sendRunCommand()

0 commit comments

Comments
 (0)