-
Notifications
You must be signed in to change notification settings - Fork 92
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
Folding mechanism for while/for/if/switch-case #1562
base: master
Are you sure you want to change the base?
Folding mechanism for while/for/if/switch-case #1562
Conversation
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/folding/DefaultJavaFoldingStructureProvider.java
Show resolved
Hide resolved
08cd1d9
to
afd4aed
Compare
Bug:
|
c2082f5
to
0390f1c
Compare
c1ac59f
to
80ee66d
Compare
d5cf645
to
a44a7e0
Compare
The test failures seem to be unrelated: https://ci.eclipse.org/jdt/job/eclipse.jdt.ui-github/job/PR-1562/21/testReport/ The only test that fails with age == 1 (i.e. in this PR) is java.lang.AssertionError:
Wrong bundles loaded:
- org.eclipse.jdt.junit
expected:<0> but was:<24>
at org.junit.Assert.fail(Assert.java:89)
at org.junit.Assert.failNotEquals(Assert.java:835)
at org.junit.Assert.assertEquals(Assert.java:647)
at org.eclipse.jdt.text.tests.PluginsNotLoadedTest.pluginsNotLoaded(PluginsNotLoadedTest.java:278)
... Does anyone know the reason for this failure? In the meantime @jakub-suliga, try with another force-push to re-trigger the checks and see if the failure persists. |
a44a7e0
to
b49f6c9
Compare
On a closer look, the test failures are because of the changes introduced in this PR. Run them locally and you will see it. Here's (part of) the console output when running !STACK 0
java.lang.ClassCastException: class org.eclipse.jdt.internal.core.ClassFile cannot be cast to class org.eclipse.jdt.core.ICompilationUnit (org.eclipse.jdt.internal.core.ClassFile and org.eclipse.jdt.core.ICompilationUnit are in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @21452f5e)
at org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider.computeFoldingStructure(DefaultJavaFoldingStructureProvider.java:981)
at org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider.update(DefaultJavaFoldingStructureProvider.java:907)
at org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider.initialize(DefaultJavaFoldingStructureProvider.java:852)
at org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider.handleProjectionEnabled(DefaultJavaFoldingStructureProvider.java:822)
at org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider$ProjectionListener.projectionEnabled(DefaultJavaFoldingStructureProvider.java:700)
...
at org.eclipse.jdt.ui.tests.quickfix.AnnotateAssistTest1d5.testAnnotateReturn2(AnnotateAssistTest1d5.java:178)
... It seems the It would be interesting to know when exactly is |
d68c88b
to
baf2632
Compare
@iloveeclipse : Jakub and I were looking into the failed tests and we found the culprit: it was a Do you see any possible problem with this change? We couldn't come up with any but maybe you can? |
Looks OK, but I don't have IDE access till monday. Note, there is a test fail which seem to be related: https://ci.eclipse.org/jdt/job/eclipse.jdt.ui-github/job/PR-1562/26/testReport/(root)/JdtTextTestSuite%20ParameterNamesCodeMiningTest/testCollapsedFoldingAndToggleHighlight/ Also it seem that you have removed two protected methods? Isn't this class public API (can't see it in browser). If so, you can't do that. Also there are two additional warnings added, please check. |
Yes, Jakub will look into that.
The methods are still there, they are lost in the big chunk of changes. Regarding that, @jakub-suliga please extract the anonymous class to a new private class and put it at the beginning of the class, this should move the big chunk of new code and make the reviewing easier. |
ade7b52
to
e7d8254
Compare
There are some Bugs:
|
51c2222
to
b74173b
Compare
85e9e56
to
36a0edb
Compare
7d79911
to
721f908
Compare
721f908
to
6695167
Compare
Problem:
Currently, there is no folding mechanism for while/for/if/switch-case statements in Eclipse. VSCode and IntelliJ support a folding mechanism for these statements. Therefore, I have created a method that implements this folding mechanism. This is also an open issue: #1426. In addition, I deleted some commented-out code from 2007.
Before:
After:
How to test:
Here is a small program you can use to test:
Bugs: