Prior to formatting (and what is desired):
C#ContentAvailabilityGroup[] results = cacheContentGroups
.Select(cacheGroup => new ContentAvailabilityGroup()
{
ExternalId = cacheGroup.ExternalId,
Availabilities = cacheGroup.GetSpecificMatches(request)
.Select(availability => availabilityFactory.Build(availability))
.ToArray(),
})
.ToArray();
After formatting (not desired):
C#ContentAvailabilityGroup[] results = cacheContentGroups
.Select(cacheGroup => new ContentAvailabilityGroup()
{
ExternalId = cacheGroup.ExternalId,
Availabilities = cacheGroup.GetSpecificMatches(request)
.Select(availability => availabilityFactory.Build(availability))
.ToArray(),
})
.ToArray();
How do I get the desired formatting? I get the correct formatting when my object is created outside of a Select lambda expression.
This is with chained method formatting turned off because if chained method is turned on, then the .ToArray ends up not being indented at all (which would be another bug, I suppose).
Hi Jason,
Thank you for the code sample. It seems that our formatting engine doesn't correctly handle code constructions inside lambda expressions. We are researching the issue in detail to find possible ways to improve the code formatting. Thank you for your patience.
I've discovered it's not just lambdas. Any kind of initializer inside of a call seems to have issues.
This:
var results = await ContentConsumer.GetContentsAsync(new ContentRequest() { ContentIds = contentIds, DisplayDate = displayForDate, MaxTemplateDepth = depth, });
Becomes this:
var results = await ContentConsumer.GetContentsAsync(new ContentRequest() { ContentIds = contentIds, DisplayDate = displayForDate, MaxTemplateDepth = depth, });
I do want to say that the formatting engine is coming across really nicely, and I can live with the issues I've discovered so far. I'm still tweaking to determine the difference between bugs, missing features, and need of config changes. I'm super glad that it looks like I won't need to renew my subscription to a certain other tool that does formatting that also destroys performance despite all other features being turned off.
Jason,
Thank you for another sample - it will help us in our research. Let me take a moment and thank you for your valuable feedback that helps us make our formatting engine better!