Skip to content

Commit 9bdd997

Browse files
authored
Improve inline breakpoint discovery when expression is multiline. Fix #521 (#522)
* Improve inline breakpoint discovery when expression is multiline. Fix #521
1 parent 27f72fb commit 9bdd997

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/BreakpointLocationLocator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public class BreakpointLocationLocator
2222

2323
public BreakpointLocationLocator(CompilationUnit compilationUnit, int lineNumber,
2424
boolean bindingsResolved,
25-
boolean bestMatch) {
26-
super(compilationUnit, lineNumber, bindingsResolved, bestMatch);
25+
boolean bestMatch, int offset, int end) {
26+
super(compilationUnit, lineNumber, bindingsResolved, bestMatch, offset, end);
2727
}
2828

2929
@Override

com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JdtSourceLookUpProvider.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@
7272
import com.microsoft.java.debug.core.Configuration;
7373
import com.microsoft.java.debug.core.DebugException;
7474
import com.microsoft.java.debug.core.DebugSettings;
75-
import com.microsoft.java.debug.core.JavaBreakpointLocation;
7675
import com.microsoft.java.debug.core.DebugSettings.Switch;
76+
import com.microsoft.java.debug.core.JavaBreakpointLocation;
7777
import com.microsoft.java.debug.core.adapter.AdapterUtils;
7878
import com.microsoft.java.debug.core.adapter.Constants;
7979
import com.microsoft.java.debug.core.adapter.IDebugAdapterContext;
@@ -210,8 +210,11 @@ public JavaBreakpointLocation[] getBreakpointLocations(String sourceUri, SourceB
210210
// mark it as "unverified".
211211
// In future, we could consider supporting to update the breakpoint to a valid
212212
// location.
213+
214+
// passing the offset to the constructor, it can recognize the multiline lambda
215+
// expression well
213216
BreakpointLocationLocator locator = new BreakpointLocationLocator(astUnit,
214-
sourceLine, true, true);
217+
sourceLine, true, true, astUnit.getPosition(sourceLine, 0), 0);
215218
astUnit.accept(locator);
216219
// When the final valid line location is same as the original line, that
217220
// represents it's a valid breakpoint.

0 commit comments

Comments
 (0)