This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 99495

Summary: Eclipse feature wanted: More extensive code formatting rules
Product: java Reporter: hbjastad <hbjastad>
Component: EditorAssignee: Dusan Balek <dbalek>
Status: RESOLVED DUPLICATE    
Severity: blocker CC: bleonard, gsporar, pramodkc
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description hbjastad 2007-03-30 08:26:38 UTC
With a team of developers, they should all use the same code formatting rules.
In Eclipse, we can define the code formatting rules, export them and store them
in Subversion. Then all developers can import these. From what I can see, the
following features are missing in NetBeans (compared to Eclipse):

1. Allow one to do "Format Code" in the project navigator (i.e. on a package or
an entire project, not just inside a single Java file)

2. Extend the code formatting rules (Eclipse provides A LOT more control over
the formatted code)

3. Allow import/export of code formatting rules
Comment 1 hbjastad 2007-03-30 10:56:25 UTC
It seems like a lot of this (at least #2 and #3) can be handled by the Jalopy
plugin: http://www.triemax.com/products/jalopy/manual/plugin-netbeans.html

However, with Eclipse it comes for free... :-)
Comment 2 pramodkc 2007-10-20 13:50:15 UTC
Right now the only thing preventing me from introducing netbeans in an eclipse env at a very large financial firm  is
code formatting. The reason this is a big issue - if we do not manage to get netbeans to format like eclipse, the
clearcase will start showing differences due to formatting all over the place and the actual change would become very
difficult to find, so this is absolutely essential if you want netbeans and eclipse to co-exist in any real world
project, people might now say it explicitly but this would be showstopper. I have been trying to change eclipse rules
and netbeans rules to match but the biggest stumbling block is the weird feature you guys have added in 6.0 where code
formatting will completely ignore line breaks. Eclipse has this cool feature that if your code line get longer than a
predefined limit (say 135 ) then it will break it into multiple lines. But netbeans will make it one long line again. 
You can contact me directly for more details - pramod@pravaah.com

The reason I changed it to a P1 - if you could just introduce a new flag so netbeans will not ignore line breaks or get
netbeans to split a line when it goes longer than a certain limit it will atleast be possible for netbeans and eclipse
to co-exist otherwise it is a deal breaker.


Comment 3 Jiri Prox 2007-10-20 14:38:07 UTC
There new formatting setting introduced in 6.0, including the line wrap options. See Options->Java Code-> Formatting
The latest daily build should also respect line breaks.

Other features requested in this issue are unfortunately not implemented yet and won't be included in 6.0, since the 6.0
is feature frozen now.
Comment 4 Jiri Prox 2007-10-20 14:39:52 UTC
There new formatting setting introduced in 6.0, including the line wrap options. See Options->Java Code-> Formatting
The latest daily build should also respect line breaks.

Other features requested in this issue are unfortunately not implemented yet and won't be included in 6.0, since the 6.0
is feature frozen now.
Comment 5 viggonavarsete 2008-06-03 12:31:24 UTC
will this issue be considered for the next version of Netbeans? (6.2?)
Comment 6 markiewb 2015-04-06 20:02:28 UTC
(In reply to hbjastad from comment #0)
> With a team of developers, they should all use the same code formatting
> rules.
> In Eclipse, we can define the code formatting rules, export them and store
> them...

Dup of #197876

*** This bug has been marked as a duplicate of bug 197876 ***