Community
Participate
Working Groups
I always resented this and eventually it made me open a defect report :-): When I use auto-formatter in Java editor, it does not add any space between package imports and other code. This results in the following format: import org.eclipse.ui.*; import org.eclipse.pde.ui.*; class Foo extends Bar { } This is not a good default - the code would look much better with a line to separate the two. Not all the classes have Javadoc comments - many are internal and I am tired of adding artificial Javadoc just to achieve this separation.
Default formatter setting are defined by JDT/Core.
It is trivial to add your own profile and change the default settings.
Move to JDT/Text for comment. The default profile doesn't preserve one of the options provided by the old code formatter settings. I should set the number of blank line to preserve to 1 instead of 0. The old formatter doesn't add blank lines. So if no blank lines were present between the import declarations and the type declarations, none would be inserted. This might require some tests to be updated. This would fix two PRs. Is it ok for you to change the default settings? I will run all your tests changing this settings after tomorrow integration build.
ok.
Daniel, Instead of changing jdt.ui tests, would it be possible for you to set your code formatter options in your tests to preserve the old settings (remove all blank lines)? This would prevent you from updating tests when default options change.
How can we do this? Wouldn't we have to set all preferences in fact use our own profile?
In fact it would be much better for you (to be independant from changes in the default options) to use your own profile. You can also simply get the default settings and change the options you want inside the map.
>You can also simply get the default settings and change the options you want >inside the map. Yep - but then we stil depend on the defaults not being changed.
3 tests need to be updated in jdt.ui tests AddUnimplementedConstructorsTest. So we need to synchronize these changes. By using your own profile, you could define a profile that is using current default values (not relying on defaults). Then you would not be affected by changes in the default settings. You might however be affected by fixes in the code formatter.
If you send me a (working ;-) JCore preview I can do it anytime. JDT UI then uses the preview.
Changed the default settings to preserve one blank line.
If you want a new line to be added, then update your code formatter profile.
*** Bug 49024 has been marked as a duplicate of this bug. ***
Verified for 3.0M9