Chain break with template arguments
string main()
{
- return duration.total!"seconds".to!string;
+ return duration.total!"seconds"
+ .to!string;
}
It doesn't seem to happen if the chain has only one !.
I hope it isn't already reported since there're some similar issues, similar, but still different.
this is by design / how it was initially implemented, see https://github.com/dlang-community/dfmt/blob/58b2c6ebc620af1351821509b435c821cd175d90/src/dfmt/ast_info.d#L346
Maybe adding something like || (chainLength == 1 && totalChainLength > 3) || totalChainLength > 4 with a totalChainLength variable counting all unary expressions with u.identifierOrTemplateInstance set (no matter if template or not) could be what you want. However setting these thresholds would need more testing in bigger repositories to see how it affects them.
I'm a bit confused because it works differently with similar expressions.
For example this one is left as is:
string main()
{
return duration.total("seconds").to!string;
}
(Same code, but "seconds" is a normal argument and not a template argument).
I see now, that even this is left as is:
string main()
{
return duration.total!"seconds"().to!string;
}
(Just with () after "seconds")
I would be happy if it works with keep_line_breaks without breaking the line, because currently it doesn't.
ufcs breaking only occurs once the line reaches some minimum length iirc