-
Notifications
You must be signed in to change notification settings - Fork 109
enable folding with "Only show selected Java element" #2302
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
enable folding with "Only show selected Java element" #2302
Conversation
|
I wrote some basic tests for the PR in eclipse.platform.ui. Is it also necessary to add integration tests in JDT-UI for this change? |
If possible, regression test for original problem? |
6967565 to
a6a006f
Compare
I added a test that ensures folding is active (even though I am not sure whether this is actually a bug I'm fixing or more implementing a feature/enhancement). But note that in order to work correctly, the other PR would need to be merged/integrated first (and my test wouldn't detect that currently). |
f8e0768 to
84fa6a1
Compare
|
The test failure should be because this depends on eclipse-platform/eclipse.platform.ui#3074 which is not merged. |
|
The changes I made to |
ef87738 to
2cc9c2d
Compare
...t.text.tests/src/org/eclipse/jdt/text/tests/folding/FoldingWithShowSelectedElementTests.java
Show resolved
Hide resolved
|
In situations where #2327 occurs and that region is added/removed when editing the editor, the parts after the visible region can become visible but that's fixed by that PR. Other than that, I think this PR and eclipse-platform/eclipse.platform.ui#3074 are ready for someone to take a look at it. |
2cc9c2d to
ebe65ee
Compare
|
Would @iloveeclipse or someone else care to review these two PRs at some point? |
1b8ff59 to
36e790f
Compare
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/folding/DefaultJavaFoldingStructureProvider.java
Outdated
Show resolved
Hide resolved
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/folding/DefaultJavaFoldingStructureProvider.java
Outdated
Show resolved
Hide resolved
|
Seem to work fine except the binary types (e.g. java.lang.String etc), I guess similar change like it was in JavaEditor is needed for ClassFileEditor. |
36e790f to
8e29d7c
Compare
Did the "Only show the selected Java element" option ever work with the Class File Editor? I didn't see that doing anything without my change and this PR doesn't seem to impact that. |
Honestly, no idea, I never used this "Only show the selected Java element" option, just assumed it should work there too :-) |
8e29d7c to
98e8c31
Compare
61996c0 to
67e0c15
Compare
67e0c15 to
934e63e
Compare
|
Hi @danthe1st I'd be happy to review this once the platform UI patch is in. |
2cd167d to
25b2c85
Compare
25b2c85 to
88ac1b3
Compare
|
Even though the |
You probably mean Platform UI patch?
This would be better tha patch here is small enough and shouldn't be a problem to revert. |
Yes, my fault (edited)
I see. @jjohnstn would you still want to review this now? |
|
@jjohnstn ^ Sorry I originally messed up the ping |
88ac1b3 to
8e88fc9
Compare
|
^ rebased, fixed merge conflicts |
|
I am seeing a issue when testing. If I have: When I select test() in the outline view, it shows test() only but it also shows the // region comment above it (AST elements get tied to line comments above them and on the same line). It is recognized as a custom folding comment but clicking on it does not hide the test() method. It adds the end-of-line stuff in a normal folding on all of the test() lines. I can confirm that folding within test() works fine. |
jjohnstn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See main-line comment
When writing the Platform-UI patch, I ensured that it is not possible to fold anything outside of the visible region (as it didn't make sense IMO). I think I can provide another PR there that ensures that these annotations are hidden. |
|
I created eclipse-platform/eclipse.platform.ui#3423 to fix this issue. |
8e88fc9 to
c06ab2e
Compare
|
@jjohnstn Would you like to review this now for 2026-03? There are still eclipse-platform/eclipse.platform.ui#3457 (small GUI change), eclipse-platform/eclipse.platform.ui#3456 (fixing some exception) and eclipse-platform/eclipse.platform.ui#3585 (fixing too much being hidden at the end with Windows line endings) but I think these shouldn't block this review (much). |
jjohnstn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Fixes #2264
Depends on eclipse-platform/eclipse.platform.ui#3074 (Is it necessary to change the version requirements in some way even if I am not depending on any new API?)
Depends on #2410 for this to work correctly with extended foldingThat dependency PR has been merged.I think this should be tested with JDT-UI (with this PR) before eclipse-platform/eclipse.platform.ui#3074 is merged.
What it does
This PR enables folding when Window > Preferences > Java > Editor > Only show the selected Java element is enabled.
This depends on eclipse-platform/eclipse.platform.ui#3074 to work correctly.
How to test
Include Allow using visible regions with projections eclipse-platform/eclipse.platform.ui#3074not necessary any more since that's merged, just make sure to use the latest I-build of eclipse.platform.uiAuthor checklist
If only a selected region is shown and one enters text at the end of that region (if the curser is exactly after the closingThis was an issue with my changes in eclipse.platform.ui which should be fixed.}), everything after the selected region is displayed. I am not sure whether that's an issue. See https://github.com/user-attachments/assets/18cc621f-1c69-45e6-a7ce-97d609f489fe