Skip to content

Conversation

@danthe1st
Copy link
Contributor

What it does

In #2282, I implemented folding of custom regions if the start and end region markers are the same.
This stops processing when the last comment is reached. In that case, I forgot to ensure that all remaining open folding regions need to be created appropriately.

For example, consider the following reproducer:

  • Enable extended folding (if disabled)
  • Enable custom folding regions
  • Set both the start and end region marker comments to ----- in Window > Preferences > Java > Editor > Folding
  • Create the following class:
package org.example.test;

public class Repro {
	
	// ----- getters/setters -----

	public String test(boolean b) {
		if (b)
			
			return "a";
		return "b";
	}

}

The region for the // ----- getters/setters ----- comment is missing.

How to test

Use the reproducer above (or similar) and see that the region is present.

This is also included as a text case.

Author checklist

Copy link
Contributor

@jjohnstn jjohnstn left a comment

Choose a reason for hiding this comment

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

Looks good.

@jjohnstn jjohnstn merged commit 10024da into eclipse-jdt:master Jul 8, 2025
13 checks passed
@jjohnstn jjohnstn added the enhancement New feature or request label Jul 8, 2025
@jjohnstn jjohnstn added this to the 4.37 M2 milestone Jul 8, 2025
@danthe1st danthe1st deleted the fix-folding-early-return branch July 9, 2025 05:04
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.

2 participants