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 65619

Summary: Indentation engine: indent braces too
Product: java Reporter: shalomcrown <shalomcrown>
Component: EditorAssignee: Dusan Balek <dbalek>
Status: NEW ---    
Severity: blocker CC: kjmcdonald
Priority: P3    
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description shalomcrown 2005-10-02 10:30:55 UTC
The style of indentation where the braces line up with the code in the inner
block  (i.e. are themselves indented) is not supported by the Java indentation
engine. This could be added by adding an option for "add extra tab ebfore
opening and closing braces".

Without this option it is necessary to manually add tabs before the
automatically inserted braces.
Comment 1 Jiri Prox 2006-06-06 15:34:47 UTC
Can you provide some example, please?
Comment 2 shalomcrown 2006-06-06 16:45:06 UTC
The style of indenting that Netbeans supports:

   for (int j = 0; j < 10; j++)
   {
      // Statements indented to here Braces in line with outer block
      r = 10;
   }

The coding style in use in many companies:

   for (int j = 0; j < 10; j++)
      {
      // Statements indented to here Braces in line with INNER code
      r = 10;
      }

For some reason Java style guides specify the first type - and that is all the
Java indentation engine supports. However the second type makes it easier to
find the braces that enclose the statements - and is a style mandated by many
organizations. 
Comment 3 kjmcdonald 2007-04-24 17:31:27 UTC
I'd like to request an option for:

   for (int j = 0; j < 10; j++)
     {
       // Statements indented to here Braces in line with INNER code
       r = 10;
     }

This could be expressed either as:

1. indent braces, and then indent code inside braces again (indent=2), or
2. indent braces by only half an indent (indent=4).

Comment 4 Jiri Prox 2007-04-24 17:45:06 UTC
Both way of formatting will be supported in upcoming 6.0 version