In general, please allow configuring indent to place indentation terminators on their own line; e.g., a multiline-case-list-terminating : would optionally be on its own line, presumably unindented by one level.
// current formatting
case
.a,
.b:
doSomething()
case …
// desired formatting
case
.a,
.b
:
doSomething()
case …
The desired formatting renders .b distinct from doSomething().
It's similar to having an opening or closing parenthesis, bracket, or brace on its own line unindented by one to close out the prior indentation level.
Maybe you want to have each indent terminator configurable individually, but I don't think any configuration exists for opening or closing parentheses, brackets, braces, or any other indentation terminators, either individually or collectively.
I imagine 3 or 4 values for options (whatever the options are named) to configure indentation terminator spacing (individually or collectively) (the comments are just to draw attention; they wouldn't be in actual code):
preserve
attach, e.g.:
case
.a,
.b: // attached
…
case …:
if
condition() { // attached
then()
}
unindent, e.g.:
case
.a,
.b
: // unindented
…
case …:
if
condition()
{ // unindented
then()
}
indent (this seems terrible, so I'd omit it, but I included it here for completeness), e.g.:
case
.a,
.b
: // indented
…
case …:
if
condition()
{ // indented
then()
}
It seems that the existing behavior is hardcoded to unindent for closing parentheses, brackets & braces, but to attach for case-list-terminating colons. I haven't verified if existing behavior is preserve or unindent for opening braces or other opening delimiters (I'm just on my phone), or looked for other indentation terminators.
I'd imagine that you'd want the defaults to match existing behavior, though I prefer unindent as the universal default.
In general, please allow configuring
indentto place indentation terminators on their own line; e.g., a multiline-case-list-terminating:would optionally be on its own line, presumably unindented by one level.The desired formatting renders
.bdistinct fromdoSomething().It's similar to having an opening or closing parenthesis, bracket, or brace on its own line unindented by one to close out the prior indentation level.
Maybe you want to have each indent terminator configurable individually, but I don't think any configuration exists for opening or closing parentheses, brackets, braces, or any other indentation terminators, either individually or collectively.
I imagine 3 or 4 values for options (whatever the options are named) to configure indentation terminator spacing (individually or collectively) (the comments are just to draw attention; they wouldn't be in actual code):
preserveattach, e.g.:unindent, e.g.:indent(this seems terrible, so I'd omit it, but I included it here for completeness), e.g.:It seems that the existing behavior is hardcoded to
unindentfor closing parentheses, brackets & braces, but toattachfor case-list-terminating colons. I haven't verified if existing behavior ispreserveorunindentfor opening braces or other opening delimiters (I'm just on my phone), or looked for other indentation terminators.I'd imagine that you'd want the defaults to match existing behavior, though I prefer
unindentas the universal default.