Skip to content

Add Support for Stepping out of Code Blocks feature - #999

Open
SougandhS wants to merge 1 commit into
eclipse-jdt:masterfrom
SougandhS:StepOutNew
Open

SougandhS wants to merge 1 commit into
eclipse-jdt:masterfrom
SougandhS:StepOutNew

Conversation

@SougandhS

Copy link
Copy Markdown
Member

Introduce a new debugger operation that allows users to step out of the current loop, conditional statement, or nested code block etc. The operation uses run-to-line to identify the first executable line after the enclosing block and is available through the keyboard shortcut (Shift+F7), toolbar, and debug context menus.

Screenshot 2026-09-09 at 1 34 38 PM

Screenshot 2026-09-09 at 1 36 11 PM
Working.mp4

Fixes #966

What it does

How to test

Author checklist

@SougandhS
SougandhS force-pushed the StepOutNew branch 4 times, most recently from e2d6c48 to 948ad7d Compare September 10, 2026 00:16
@SougandhS

Copy link
Copy Markdown
Member Author

Hi @iloveeclipse, can you trigger a co-pilot review ?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Target resolution can select incorrect or unrelated code locations, and the new test has a suspension-event race.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a debugger command to step out of the current Java code block using run-to-line behavior.

Changes:

  • Adds the Shift+F7 command, toolbar button, menus, and icon.
  • Implements AST-based enclosing-block target resolution.
  • Adds automated stepping coverage and a test program.
File summaries
File Description
StepOutOfCodeBlockHandler.java Implements command handling and enablement.
RunToLineAdapter.java Adds block-exit target calculation.
plugin.xml Registers command, menus, toolbar, and shortcut.
plugin.properties Adds command labels.
stepOutBlock.svg Adds toolbar icon.
AutomatedSuite.java Registers the new test suite.
AbstractDebugTest.java Adds the test program fixture.
StepOutOfCodeBlockTests.java Tests block stepping behavior.
StepOutCodeBlockPgm.java Provides stepping scenarios.
Review details
  • Files reviewed: 8/9 changed files
  • Comments generated: 6
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@SougandhS

Copy link
Copy Markdown
Member Author

@iloveeclipse Do you have any suggestions ?

@SougandhS
SougandhS force-pushed the StepOutNew branch 2 times, most recently from 8c29498 to 7eb5a33 Compare September 22, 2026 10:51
@SougandhS

Copy link
Copy Markdown
Member Author

@iloveeclipse Do you have any suggestions ?

Im planning to include this in M1 If no further changes are required..

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Block detection misses valid constructs and the shared adapter regresses existing Run to Line error handling.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity · 1 Low severity

Open (3)
Resolved since last review (4)

Comment thread org.eclipse.jdt.debug.ui/plugin.properties Outdated
@iloveeclipse

iloveeclipse commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

@SougandhS : as JDT committer, you should be able to enable Copilot Enterprise for your github account and run Copilot reviewer by yourself. Would be great if you could just do it without waiting me to trigger that. You can do this on your Eclipse account https://accounts.eclipse.org/users/<your account name> , there under "Link GitHub Account" you can toggle "Opt in to GitHub Copilot Enterprise for Eclipse Committers" checkbox.

@SougandhS

Copy link
Copy Markdown
Member Author

@SougandhS : as JDT committer, you should be able to enable Copilot Enterprise for your github account and run Copilot reviewer by yourself. Would be great if you could just do it without waiting me to trigger that. You can do this on your Eclipse account https://accounts.eclipse.org/users/<your account name> , there under "Link GitHub Account" you can toggle "Opt in to GitHub Copilot Enterprise for Eclipse Committers" checkbox.

Thanks Andrey, I thought this feature was only for JDT Leads. I have linked my account and toggled the option now 👍 .. Might take some time to reflect it in my profile

@iloveeclipse

Copy link
Copy Markdown
Member

Might take some time to reflect it in my profile

I can't remember if there was anything special to switch in your github profile too, something like "enable AI" or so. Please double check https://github.com/settings/copilot/features. At the very top it should show something like this:

image

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unbraced constructs and method-return fallback paths currently produce incorrect stepping behavior.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Breakpoint lookup can select unreachable code inside a following local class declaration.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Loop bodies followed by local classes can produce an unreachable run-to-line target.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The local-class traversal path lacks coverage, and invalid-target feedback incorrectly blames the editor selection.

1 open finding
1 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Low severity Report when no valid step-out target exists

org.eclipse.jdt.debug.ui/​ui/​org/​eclipse/​jdt/​internal/​debug/​ui/​actions/​RunToLineAdapter.java:144

This message refers to a “selected line,” but block stepping ignores the editor selection and derives the request from the suspended frame. It is also used when a block exists but has no executable successor in the enclosing declaration, so the current wording incorrectly tells users that their selection is the problem. Report that no valid step-out target could be found instead.

🧠 Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Forward breakpoint lookup can incorrectly descend into a local class following a loop or synchronized block.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Local classes following loop bodies can still produce unreachable run-to-line targets.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Control-statement headers are not handled correctly, and the Java 23 tests are registered without runtime gating.

2 open findings

🧠 Review effort: Balanced

Comment thread org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Block traversal can select unreachable branches and does not correctly handle unbraced constructs or some local-class successors.

2 open findings
1 resolved since last review

🧠 Review effort: Balanced

@SougandhS
SougandhS requested a balanced review from Copilot October 9, 2026 08:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Block traversal still mishandles unbraced control statements and local classes following loop bodies.

2 open findings

🧠 Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Control-statement header suspension and nested local-type successors can produce missing or unreachable step-out targets.

1 open finding
2 resolved since last review

🧠 Review effort: Balanced

Introduce a new debugger operation that allows users to step out of the
current loop, conditional statement, or nested code block. The operation
uses run-to-line to identify the first executable line after the
enclosing block and is available through the keyboard shortcut
(Shift+F7), toolbar, and debug context menus.

Fixes eclipse-jdt#966
@SougandhS

Copy link
Copy Markdown
Member Author

I think most cases are handled now, and any rare edge cases that may have been missed can be addressed as they are reported.

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: Extend "Step Return" (F7) to jump outside of code blocks (loops, if-statements)

3 participants