Braces Layout for Array and object initializer

I'm finding the options for BracesLayout for Array and object initializers a
little restrictive. In the trival cases that the options editor presents
everything looks great, but it ignores the fact that code in an array or
object initializer usually already indented three times (namespace, class,
method) and class names, variable names etc can also be a lot longer than
the examples provided

I've replaced tabs with "---" so you can see what I mean

This example uses short identifiers so isn't too bad:

--- --- --- int[] array = new int[]

--- --- --- --- --- --- {

--- --- --- --- --- --- --- 1, 2, 3
--- --- --- --- --- --- }

BSD Style with longer identifiers looks like this, and is possibly way off
the side of my screen by now:

--- --- --- SomeLongClassName instance = new SomeLongClassName
--- --- --- --- --- --- --- --- --- --- --- --- {
--- --- --- --- --- --- --- --- --- --- --- --- --- PropertyNameOne =
SomeClass.SomeLongMethodName("SomeLongString"),
--- --- --- --- --- --- --- --- --- --- --- --- --- PropertyNameTwo =
SomeClass.SomeLongMethodName("SomeLongString"),
--- --- --- --- --- --- --- --- --- --- --- --- };



What I think is missing is an option like this:

--- --- --- SomeLongClassName instance = new SomeLongClassName
--- --- --- {
--- --- --- --- PropertyNameOne =
SomeClass.SomeLongMethodName("SomeLongString"),
--- --- --- --- PropertyNameTwo =
SomeClass.SomeLongMethodName("SomeLongString"),
--- --- --- };


Also the formatter seems to be putting in spaces rather than tabs. This
will not look right for people who use non-standard tab sizes (which is fine
as long as all indenting is done using tabs which imho it should be).

Anyone have the same thoughts? Are there any other formatting options being
considered?

Thanks,
Cameron Elliot


1 comment
Comment actions Permalink

I've just seen how that message was formatted. This better demonstrates my
point I hope:


BSD Style:

--- --- --- SomeLongClassName instance = new SomeLongClassName
--- --- --- --- --- --- --- --- --- --- --- --- {
--- --- --- --- --- --- --- --- --- --- --- --- --- PropNameOne = ...
--- --- --- --- --- --- --- --- --- --- --- --- --- PropNameTwo = ...
--- --- --- --- --- --- --- --- --- --- --- --- };


What I think is missing is an option like this:

--- --- --- SomeLongClassName instance = new SomeLongClassName
--- --- --- {
--- --- --- --- PropertyNameOne = ...
--- --- --- --- PropertyNameTwo = ...
--- --- --- };

Cameron


0

Please sign in to leave a comment.