dfmt
dfmt copied to clipboard
Indentation of the function literals in the argument list
Here is an example with a lambda and function literal, formatted with ./dfmt --max_line_length=80 test.d:
void main()
{
object.toString(firstArgument12345678901234567890123456789012345678900,
(const string anotherArgumentWithSomeRandomLongNameWhichIsJustVeryLong)
- => x);
+ => x);
object.toString(firstArgument12345678901234567890123456789012345678900,
(const string anotherArgumentWithSomeRandomLongNameWhichIsJustVeryLong) {
- return x;
- });
+ return x;
+ });
}
- I think that the lambda body should get additional identation in this case (as in the original code).
- Argument wrapping for the function literal is replaced with the indentation — I think indentation and wrapping should be combined there (as in the original code).
Similar case:
void main() {
foo!(
(int _2345678901234567890123456789012345678901234567890123456789012345678901234567) => X(
foo));
}
I think this is more bug than enhancement.
as long as code behavior doesn't change by formatting I don't think it can be called a bug for a code formatter.
let's call this priority enhancement
about the wrapping: would probably be nice if it would put the => in the next line if it doesn't fit anymore or if it still fits then keep it there and otherwise just move the value to the next line.