I've been trawling the docs and I don't think this exists as an option but basically I want to enforce each parameter of a function call to be on a new line.
e.g. I hate this:
var result = GetResult(request, startDate, endDate, myTypes,
false, false, pageNumber);
and I hate this even more (different numbers of parameters per line):
var result = GetResult(request, startDate, endDate, myTypes,
person, thing,
false, false, pageNumber, penny, job, situation, context);
I would love an editorconfig entry to make the above into:
var result = GetResult(
request,
startDate,
endDate,
myTypes,
false,
false,
pageNumber);
and
var result = GetResult(
request,
startDate,
endDate,
myTypes,
person,
thing,
false,
false,
pageNumber,
penny,
job,
situation,
context);
Ideally I'd be able to specify the maximum number of parameters before it forces the above, but this is probably a pipe dream e.g. I would want 1 or 2, maybe even 3 parameters to remain on one line line below:
var result1 = GetResult(request);
var result2 = GetResult(request, startDate);
var result3 = GetResult(request, startDate, endDate);
//only after 3 force the rule
var result4 = GetResult(
request,
startDate,
endDate,
myTypes);
I'm not aware of an EditorConfig-specific solution for this, but if you use Rider (or ReSharper, I'd assume), you can change the settings at Editor -> Code Style -> C# -> Line Breaks and Wrapping.
Under Arrangement of Method Signatures, set Wrap formal parameters to Chop if long or multiline.
Under Arrangement of Invocations, set Wrap invocation arguments to Chop if long or multiline.
From Rider's code style preview pane:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With