Alignment is a pain

Hi hate to say it but the alignment of IDEA 5 sucks.

If I have something like the following:

if (types.length > 1) // returns multiple columns
{
...
} else
result.add(initializeObject(os, types[0], initializeCollections,
initializeAssociations, initializeChildren));

It would reformat it into

if (types.length > 1) // returns multiple columns
{
...
} else result
.add(initializeObject(os, types[0], initializeCollections,
initializeAssociations, initializeChildren));


How can I get rid of that. I do want to have a new line after the else.
at least keep if it is there.

12 comments
Comment actions Permalink

Have you configured your code style correctly?

Tom

0
Comment actions Permalink

First of all Idea 5.0 tries harder to honor the right margin that you have configured.
But in many cases the wrapping is bad, I'd prefer something like
} else result.add(initializeObject(os, types[0], initializeCollections,
initializeAssociations, initializeChildren));
(with the parameter aligned).

There was a quick hack make to prefer parameter alignment to chained calls (a check box),
but that is only one occurence where parameter alignment should be preferred.
This is another.

GreyWind wrote:

Hi hate to say it but the alignment of IDEA 5 sucks.

If I have something like the following:

if (types.length > 1) // returns multiple columns
{
...
} else
result.add(initializeObject(os, types[0], initializeCollections,
initializeAssociations, initializeChildren));

It would reformat it into

if (types.length > 1) // returns multiple columns
{
...
} else result
.add(initializeObject(os, types[0], initializeCollections,
initializeAssociations, initializeChildren));


How can I get rid of that. I do want to have a new line after the else.
at least keep if it is there.

0
Comment actions Permalink

What I meant is that it should leave the the linebreak between the else
and the call.

It used to do that in 4.5

It is even worse because it also changes

if (..)
while(...)
{
}

to

if (..) while(..)
{
}

And I even copied my configuration from 4.5.

Basically it always forces the operation to be on the same line as the
control statement if there are no braces!!
The workaround is to force braces everywhere.


On Fri, 2005-08-12 at 09:58 +0200, Stephen Kelvin wrote:

First of all Idea 5.0 tries harder to honor the right margin that you have configured.
But in many cases the wrapping is bad, I'd prefer something like
} else result.add(initializeObject(os, types[0], initializeCollections,
initializeAssociations, initializeChildren));
(with the parameter aligned).

There was a quick hack make to prefer parameter alignment to chained calls (a check box),
but that is only one occurence where parameter alignment should be preferred.
This is another.

GreyWind wrote:

Hi hate to say it but the alignment of IDEA 5 sucks.

If I have something like the following:

if (types.length > 1) // returns multiple columns
{
...
} else
result.add(initializeObject(os, types[0], initializeCollections,
initializeAssociations, initializeChildren));

It would reformat it into

if (types.length > 1) // returns multiple columns
{
...
} else result
.add(initializeObject(os, types[0], initializeCollections,
initializeAssociations, initializeChildren));


How can I get rid of that. I do want to have a new line after the else.
at least keep if it is there.


0
Comment actions Permalink

Basically it always forces the operation to be on the same line as the
control statement if there are no braces!!
The workaround is to force braces everywhere.


In your Code Style, in the Alignment and Braces tab, have you tried
enabling Keep When Reformatting: Line Breaks?

Ciao,
Gordon

--
Gordon Tyler (Software Developer)
Quest Software <http://www.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: (416) 933-5046 | Fax: (416) 933-5001

0
Comment actions Permalink

Well, that's not really what I want. Because want to force that
linebreak there even if it isn't one

as I said idea 4.5 did that.

On Fri, 2005-08-12 at 11:44 -0400, Gordon Tyler wrote:

Basically it always forces the operation to be on the same line as the
control statement if there are no braces!!
The workaround is to force braces everywhere.


In your Code Style, in the Alignment and Braces tab, have you tried
enabling Keep When Reformatting: Line Breaks?

Ciao,
Gordon


0
Comment actions Permalink

Just curious, why don't you wrap your single statement in a {}?

Tom

0
Comment actions Permalink

Could you please attach code style settings?
"GreyWind" <grey.death@gmx.net> wrote in message news:1123827491.4169.20.camel@MKOPP.ftisoftus.com...
Hi hate to say it but the alignment of IDEA 5 sucks.

If I have something like the following:

if (types.length > 1) // returns multiple columns
{
...
} else
result.add(initializeObject(os, types[0], initializeCollections, initializeAssociations, initializeChildren));

It would reformat it into

if (types.length > 1) // returns multiple columns
{
...
} else result
.add(initializeObject(os, types[0], initializeCollections, initializeAssociations, initializeChildren));


How can I get rid of that. I do want to have a new line after the else. at least keep if it is there.

0
Comment actions Permalink

Fixed.
Thanks
"GreyWind" <grey.death@gmx.net> wrote in message news:1123827491.4169.20.camel@MKOPP.ftisoftus.com...
Hi hate to say it but the alignment of IDEA 5 sucks.

If I have something like the following:

if (types.length > 1) // returns multiple columns
{
...
} else
result.add(initializeObject(os, types[0], initializeCollections, initializeAssociations, initializeChildren));

It would reformat it into

if (types.length > 1) // returns multiple columns
{
...
} else result
.add(initializeObject(os, types[0], initializeCollections, initializeAssociations, initializeChildren));


How can I get rid of that. I do want to have a new line after the else. at least keep if it is there.

0
Comment actions Permalink

That's the workaround not the solution ;-). Anyway, jetbrains seem to
have it fixed already.

On Sat, 2005-08-13 at 13:22 +0200, Thomas Singer wrote:

Just curious, why don't you wrap your single statement in a {}?

Tom


0
Comment actions Permalink

No Thank you, that was fast. I guess it will be in the next build

On Mon, 2005-08-15 at 16:15 +0400, Olesya Smirnova wrote:


Fixed.
Thanks
"GreyWind" <grey.death@gmx.net> wrote in message
news:1123827491.4169.20.camel@MKOPP.ftisoftus.com...
Hi hate to say it but the alignment of IDEA 5 sucks.

If I have something like the following:

if (types.length > 1) // returns multiple columns
{
...
} else
result.add(initializeObject(os, types[0],
initializeCollections, initializeAssociations,
initializeChildren));

It would reformat it into

if (types.length > 1) // returns multiple columns
{
...
} else result
.add(initializeObject(os, types[0],
initializeCollections, initializeAssociations,
initializeChildren));


How can I get rid of that. I do want to have a new line after
the else. at least keep if it is there.


0
Comment actions Permalink

That's the workaround not the solution ;-).


Right, but a good one, because it better prevents subtle bugs. ;)

Tom

0
Comment actions Permalink

I got the same thing in 5.0.1 again. what was the bug number of this
issue, is it scheduled for the next round or did I hit a new bug

On Mon, 2005-08-15 at 16:15 +0400, Olesya Smirnova wrote:


Fixed.
Thanks

"GreyWind" <grey.death@gmx.net> wrote in message
news:1123827491.4169.20.camel@MKOPP.ftisoftus.com...
Hi hate to say it but the alignment of IDEA 5 sucks.

If I have something like the following:

if (types.length > 1) // returns multiple columns
{
...
} else
result.add(initializeObject(os, types[0],
initializeCollections, initializeAssociations,
initializeChildren));

It would reformat it into

if (types.length > 1) // returns multiple columns
{
...
} else result
.add(initializeObject(os, types[0],
initializeCollections, initializeAssociations,
initializeChildren));


How can I get rid of that. I do want to have a new line after
the else. at least keep if it is there.

0

Please sign in to leave a comment.