Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Array braces formatting(Problems with indenting of array initializer braces)
Array braces formatting [message #1439850] Tue, 07 October 2014 15:41 Go to next message
Robert Phillips is currently offline Robert PhillipsFriend
Messages: 2
Registered: October 2014
Junior Member
I'm have trouble with the settings of the Eclipse formatter (Java ID on OSX 10.9.5). I want a simple array to look like this:

Foo myFoo[] =
{
    foo1,
    foo2,
    foo3
};


but instead I get this:

Foo myFoo[] =
            {
    foo1,
    foo2,
    foo3
            };

I found a discussion about formatting multi-dimensional arrays, and followed their formatting suggestions as their arrays looked like what I want, but I can't figure out how to set the indentation of the braces to line up as I want.

- New Lines: Array Initializer: Insert new line after opening brace of array initializer (checked)

- New Lines: Array Initializer: Insert new line before closing brace of array initializer (checked)

- Braces: Array Initializer: Next Line

- Line Wrapping: Array Initializers: Wrap all elements, each element on a new line, Indent by one

[Updated on: Wed, 08 October 2014 13:41]

Report message to a moderator

Re: Array braces formatting [message #1440607 is a reply to message #1439850] Wed, 08 October 2014 15:39 Go to previous messageGo to next message
Robert Phillips is currently offline Robert PhillipsFriend
Messages: 2
Registered: October 2014
Junior Member
Okay, I found the answer. Under Indentation, don't select "Align fields in columns".

Of course, when you de-select it, you also get

    int theInt = 1;
    String someString = "Hello";
    double aDouble = 3.0;

instead of

    int    theInt     = 1;
    String someString = "Hello";
    double aDouble    = 3.0;

So, why don't the selected rules for braces apply to braces used in array declarations?

And why can't I line up the '='s in a set of assignments as the above option does for '='s in declarations?

I suspect the answers are the same: "The tool doesn't work that way".
Re: Array braces formatting [message #1440660 is a reply to message #1440607] Wed, 08 October 2014 17:12 Go to previous message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3071
Registered: July 2009
Senior Member
Automatic code formatting is a moving target; you're never going to be able to match every person's exact desires for every situation. Even trying to do so results in a formatter framework with so many configuration options that it becomes nearly unusable.
Having said that, you're welcome to submit enhancement requests into Bugzilla; just be aware that the backlog of requests and bug reports is enormous, so unless you dive in an offer to help with implementation don't expect it to be implemented soon.

[Updated on: Wed, 08 October 2014 17:13]

Report message to a moderator

Previous Topic:Bookmarks
Next Topic:Broken plugin troubles
Goto Forum:
  


Current Time: Thu Oct 24 02:56:14 GMT 2019

Powered by FUDForum. Page generated in 0.03553 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top