Skip to content

Conversation

@tsmaeder
Copy link

@tsmaeder tsmaeder commented Oct 21, 2025

Fixes #608

Note that this PR contains code for handling source breakpoints and exception breakpoints. But in fact, VS Code Java only properly handles source and instruction breakpoints. I've left the code in there, since it's not completely trivial and it should not affect the behavior if no suspend mode is sent when setting the exception breakpoints.

How to Test

  1. Set a breakpoint in a Java Program
  2. Start Debugging
  3. You now should be able to chose the suspend mode (thread or VM) in the breakpoints view and when editing the breakpoint condition.
  4. Make sure the breakpoint can suspend either all threads or only one thread depending on the mode
  5. Put your breakpoint in a for loop and when the breakpoint is hit, switch to the other suspend mode
  6. Resume the program (may need "resume all" from the context menu) and ensure the new suspend mode is honored the next time you hit the breakpoint.
  7. Make sure exception breakpoints behave as usual. There should be no UI to set the mode and exceptions should only suspend the thread the occur on.

@chagong
Copy link
Contributor

chagong commented Nov 3, 2025

@tsmaeder I wrote a simple program to test it, but got error:

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Starting application...");
       
        String message = "Hello, World!";
        System.out.println(message); // Set a breakpoint here
       
        for (int i = 0; i < 3; i++) {
            System.out.println("Count: " + i);
        }
       
        System.out.println("Application finished.");
    }
}

Error:
No delegateCommandHandler for vscode.java.resolveMainMethod
image

Also please fix CI errors.

@tsmaeder
Copy link
Author

tsmaeder commented Nov 3, 2025

@chagong how are you testing? I have a very similar program which works fine for me. Also, this PR does not contain changes that could cause a problem with the delegate command handler, IMO. Here's what I do:

  1. build a new jar with mvnw clean install
  2. copy the resulting jar to ..\vscode-java-debug\server
  3. Run the vscode-java-debug plugin from source
  4. Works fine for me 🤷

@chagong
Copy link
Contributor

chagong commented Nov 4, 2025

@tsmaeder probably the problem of my setup, it works after I relaunch vscode and F5. The PR is good to go after your fix the format errors.

Signed-off-by: Thomas Mäder <[email protected]>
Signed-off-by: Thomas Mäder <[email protected]>
@tsmaeder
Copy link
Author

tsmaeder commented Nov 6, 2025

@chagong running checkstyle:check locally spews out messages about <cr><lf> not being allowed for every file. However, that line ending is just an artifact of checking out the repo on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support "Suspend VM" and "Suspend Thread" Breakpoint Modes

3 participants