Skip to content

Commit

Permalink
Fix the step-into target on multi line expression. Fix #519
Browse files Browse the repository at this point in the history
  • Loading branch information
gayanper committed Nov 25, 2023
1 parent b0c70e3 commit 8db3f21
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ private void handleDebugEvent(DebugEvent debugEvent, IDebugSession debugSession,
} else if (currentStackDepth == threadState.stackDepth) {
// If the ending step location is same as the original location where the step into operation is originated,
// do another step of the same kind.
if (isSameLocation(currentStepLocation, threadState.stepLocation)) {
if (isSameLocation(currentStepLocation, threadState.stepLocation,
threadState.targetStepIn)) {
context.getStepResultManager().removeMethodResult(threadId);
threadState.pendingStepRequest = DebugUtility.createStepIntoRequest(thread,
context.getStepFilters().allowClasses,
Expand Down Expand Up @@ -438,15 +439,19 @@ private boolean shouldDoExtraStepInto(int originalStackDepth, Location originalL
return true;
}

private boolean isSameLocation(Location original, Location current) {
private boolean isSameLocation(Location original, Location current, MethodInvocation targetStepIn) {
if (original == null || current == null) {
return false;
}

Method originalMethod = original.method();
Method currentMethod = current.method();
// if the lines doesn't match, check if the current line is still behind the
// target if a target exist. This handles where the target is part of a
// expression which is wrapped.
return originalMethod.equals(currentMethod)
&& original.lineNumber() == current.lineNumber();
&& (original.lineNumber() == current.lineNumber()
|| (targetStepIn != null && targetStepIn.lineStart > current.lineNumber()));
}

/**
Expand Down

0 comments on commit 8db3f21

Please sign in to comment.