-
Notifications
You must be signed in to change notification settings - Fork 95
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? |
85e9e56
to
36a0edb
Compare
6695167
to
dde4098
Compare
eb70ef7
to
9ed1a12
Compare
b6d51c5
to
35b3e87
Compare
ee3706a
to
4602a47
Compare
d7b0360
to
bc2e727
Compare
bc2e727
to
28c4ddd
Compare
e110a33
to
649e208
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: