-
Notifications
You must be signed in to change notification settings - Fork 106
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
base: master
Are you sure you want to change the base?
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
b36140c
to
a9036dc
Compare
The changes to // region outer
class SomeClass {
// region inner
void someMethod() {
// content
}
// endregion
}
// endregion That class would have the following issues when the file is modified:
The reason this happens is that it tries to "update" the If wanted, I could factor out this fix to its own PR. |
a9036dc
to
ff0ff09
Compare
I have factored out the other bugfix into #2410 because smaller changes are typically preferred. This PR now only contains the logic for folding with "Only show the selected Java element". Edit: That change is merged now. |
ff0ff09
to
b4d8551
Compare
b4d8551
to
f6c5035
Compare
This pull request changes some projects for the first time in this development cycle.
An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch. Git patch
Further information are available in Common Build Issues - Missing version increments. |
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
Author 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