From 011b33c74693f138dc51834d08ca62b0f165e4b7 Mon Sep 17 00:00:00 2001 From: Jinbo Wang Date: Mon, 11 Dec 2023 14:34:17 +0800 Subject: [PATCH] Be able to search lambda breakpoint for both chained and multiline lambdas --- .../com/microsoft/java/debug/BreakpointLocationLocator.java | 5 +++++ .../java/debug/plugin/internal/JdtSourceLookUpProvider.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/BreakpointLocationLocator.java b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/BreakpointLocationLocator.java index b14afde83..adeef69d7 100644 --- a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/BreakpointLocationLocator.java +++ b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/BreakpointLocationLocator.java @@ -26,6 +26,11 @@ public BreakpointLocationLocator(CompilationUnit compilationUnit, int lineNumber super(compilationUnit, lineNumber, bindingsResolved, bestMatch); } + public BreakpointLocationLocator(CompilationUnit compilationUnit, int lineNumber, boolean bindingsResolved, + boolean bestMatch, int offset, int end) { + super(compilationUnit, lineNumber, bindingsResolved, bestMatch, offset, end); + } + @Override public boolean visit(MethodDeclaration node) { boolean result = super.visit(node); diff --git a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JdtSourceLookUpProvider.java b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JdtSourceLookUpProvider.java index f0c8795cc..a0b98a744 100644 --- a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JdtSourceLookUpProvider.java +++ b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JdtSourceLookUpProvider.java @@ -211,7 +211,7 @@ public JavaBreakpointLocation[] getBreakpointLocations(String sourceUri, SourceB // In future, we could consider supporting to update the breakpoint to a valid // location. BreakpointLocationLocator locator = new BreakpointLocationLocator(astUnit, - sourceLine, true, true); + sourceLine, true, true, astUnit.getPosition(sourceLine, 0), 0); astUnit.accept(locator); // When the final valid line location is same as the original line, that // represents it's a valid breakpoint.