Refer to the following:

Formatting like this leads to code aligned too much to the right
+1.
I think currently the table constructor behaves in the suggested way. We could try follow the same style.
Also, should the formatter be removing that new line after map(?
Its hard to determine whether to add a newline after map(, because it's yet another function argument. But if the argument exceeds the max line-length, then it should go in to the next line.
@IrushiL I think what we have done for table-constructor needs to be generalized. I mean, it should happen at the statement level, rather than the table-constructor/anon-function/etc.
A similar scenario is to when there is a function call that exeeds max-length.:
public function main() {
var foo = bar("aaaaa", "bbbbb", "cccc", "ddddd", "eeeee","aaaaa", "bbbbb", "cccc", "ddddd", "eeeee","aaaaa", "bbbbb", "cccc", "ddddd", "eeeee","aaaaa", "bbbbb", "cccc", "ddddd", "eeeee","aaaaa", "bbbbb", "cccc", "ddddd", "eeeee");
}
Formmatered Output:
public function main() {
var foo = bar("aaaaa", "bbbbb", "cccc", "ddddd", "eeeee", "aaaaa", "bbbbb", "cccc", "ddddd", "eeeee", "aaaaa",
"bbbbb", "cccc", "ddddd", "eeeee", "aaaaa", "bbbbb", "cccc", "ddddd", "eeeee", "aaaaa", "bbbbb", "cccc", "ddddd",
"eeeee");
}
Expected output:
public function main() {
var foo = bar("aaaaa", "bbbbb", "cccc", "ddddd", "eeeee", "aaaaa", "bbbbb", "cccc", "ddddd", "eeeee", "aaaaa",
"bbbbb", "cccc", "ddddd", "eeeee", "aaaaa", "bbbbb", "cccc", "ddddd", "eeeee", "aaaaa", "bbbbb", "cccc", "ddddd",
"eeeee");
}
Related Issue: https://github.com/ballerina-platform/ballerina-lang/issues/20534
A related issue with a similar behavior: https://github.com/ballerina-platform/ballerina-lang/issues/27247
Note: Check this behavior in query expressions.