Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add suspend mode for source breakpoints#610

Open
tsmaeder wants to merge 6 commits intomicrosoft:main from
tsmaeder:608_suspend_modes
Open

Add suspend mode for source breakpoints #610
tsmaeder wants to merge 6 commits intomicrosoft:main from
tsmaeder:608_suspend_modes

Conversation

@tsmaeder
Copy link

@tsmaeder tsmaeder commented Oct 21, 2025
edited
Loading

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.

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.

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 🤷

Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
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 <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Copy link
Author

tsmaeder commented Nov 6, 2025
edited
Loading

@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.

tsmaeder and others added 2 commits November 7, 2025 08:02
Copy link
Author

tsmaeder commented Feb 4, 2026

@chagong is there anything (beyond a rebase) that I could do to move this forward?

Copy link
Contributor

chagong commented Feb 4, 2026

Hi @tsmaeder, can you check if the fix to microsoft/vscode-java-debug#722 has already supported the suspend policy setting?

Copy link
Author

tsmaeder commented Feb 4, 2026

@chagong no, this PR allows to set the suspend mode per breakpoint, the other PR just introduces a global flag.

Copy link
Contributor

chagong commented Feb 5, 2026

@tsmaeder we make it a global flag because vscode doesn't have UI option to set breakpoint property. Are you doing this for cursor?

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

Reviewers

@testforstephen testforstephen Awaiting requested review from testforstephen testforstephen is a code owner

@jdneo jdneo Awaiting requested review from jdneo jdneo is a code owner

@chagong chagong Awaiting requested review from chagong chagong is a code owner

@wenytang-ms wenytang-ms Awaiting requested review from wenytang-ms wenytang-ms is a code owner

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

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

AltStyle によって変換されたページ (->オリジナル) /