Contents of array literal use continuation indent?

It seems that the code formatter considers the contents of an array
literal as code continuation and is formatting it as such.

For example, if your indent is 4 and your continuation indent is 8, an
array literal would be formatted like so:

int foo[] = new int[] {
1, 2, 3,
4, 5, 6
};

Now, personally, I view array literals like code blocks and I expect
normal indentation inside them, like so:

int foo[] = new int[] {
1, 2, 3,
4, 5, 6
};

Which do you prefer?

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

1 comment
Comment actions Permalink

I like normal indent for this case, not continuation indent.

Gordon Tyler wrote:

It seems that the code formatter considers the contents of an array
literal as code continuation and is formatting it as such.

For example, if your indent is 4 and your continuation indent is 8, an
array literal would be formatted like so:

int foo[] = new int[] {
1, 2, 3,
4, 5, 6
};

Now, personally, I view array literals like code blocks and I expect
normal indentation inside them, like so:

int foo[] = new int[] {
1, 2, 3,
4, 5, 6
};

Which do you prefer?

Ciao,
Gordon

0

Please sign in to leave a comment.