-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for lambda breakpoints #1160
Comments
method entry breakpoints are not supported in VS Code Java Debugger yet. @gayanper Are you talking about lambda entry breakpoint like this https://bugs.eclipse.org/bugs/show_bug.cgi?id=579100? Right? |
Is this the regression in eclipse-jdt/eclipse.jdt.debug#33 ? Should be fixed for 4.24 M3. |
I was trying to add a lambda breakpoint like what is available in eclipse 2020-03. But in vscode I couldn’t find a way to add the breakpoint into a specific lambda expression in stream expression for example. |
I see Eclipse has separate menus to toggle Lambda Entry Breakpoint and Function Breakpoint, we don't have similar capabilities in VS Code yet. Currently only line breakpoints are supported, where you can set a breakpoint inside a lambda body.
Yes, we also find in some cases the line breakpoints inside lambda body are not working. For example, breakpoints under stream().forEach() can be hit, but breakpoints under stream().map() will be skipped. List<String> users = Arrays.asList("Lambda");
users.stream().forEach(u -> {
System.out.println("user name: " + u); // Breakpoint at this line can be hit
});
users.stream().map(u -> {
return u; // breakpoint at this line will be skipped.
}); |
@testforstephen I cannot remember top of my head we added the lambda breakpoint toggle as a public API or not. But if we do in jdt debug, could we make use of vscode support for adding breakpoints in lambda starting point. I see that it is available for javascript and typescript at least. |
The correct vscode term is the inline breakpoints, which can be added today even thought they are treated as normal line breakpoints. I will check more and see if we can provide some support in jdt debug for this. |
Further looking at i found the vscode send us the column number we added the inline breakpoint. But since our java types doesn't have that we don't receive at SetBreakpointRequest handler. What remaining is that we should be able to look at the AST from jdtls at that location and see if we have a lambda expression (not a lambda block). From that we should be able to resolve the lambda method name by doing a |
This is an Eclipse upstream issue. I can reproduce it in Eclipse I20220507-1800 and master. |
Interesting. When setting inline breakpoints in VS Code, Java Debugger only respects line numbers but ignores the column numbers, they will actually be taken as line breakpoints. It seems registering line breakpoints on the same line twice can handle the case of having inline lambda body in one line well. But the approach @gayanper mentioned above should be a better approach to handle inline breakpoints systematically. |
@testforstephen i think setting a line breakpoint in java debugger stops on all locations in that line. When you have in-line lambda, the location includes the entry point of that lambda method as well. It works in other Eclipse the same way without any special treatment. |
Have a look again, VS Code Java Debugger provides the same behavior. When setting a breakpoint in a line, VS Code Java Debugger actually will register BreakpointRequests at all valid locations in that line. The valid locations are fetched from the JDI API ReferenceType#locationsOfLine(int lineNumber), which returns all statement locations in that line, but not the entry point of a lambda expression. |
Closing it since this has been supported in latest debugger version. |
I'm using this version:
along with Language Support for Java(TM) by Red Hat I can set the in-line breakpoint, but as I start the program in debug mode they appear disabled and don't work (the red bullet becomes grayed out). |
Environment
Steps To Reproduce
Current Result
Cannot place the beak-point.
Expected Result
Should be able to place breakpoints like in typescript code.
Additional Informations
It seems methods entry breakpoints are not supported as well. And both these type of breakpoints are not support with upstream jdt debug project.
The text was updated successfully, but these errors were encountered: