csharpier
csharpier copied to clipboard
Incorrect formatting for simple lambda expression with comment
Input:
services.AddMetricsTrackingMiddleware(
// Comment
opts =>
{
opts.IgnoredHttpStatusCodes = Enumerable.Range(300, 9).ToArray();
}
);
Output:
services.AddMetricsTrackingMiddleware(
// Comment
opts =>
{
opts.IgnoredHttpStatusCodes = Enumerable.Range(300, 9).ToArray();
});
Expected behavior:
services.AddMetricsTrackingMiddleware(
// Comment
opts =>
{
opts.IgnoredHttpStatusCodes = Enumerable.Range(300, 9).ToArray();
}
);
I sure this bug is caused by my changes in #1066. I totally forgot about cases with comments
I've found that comments tend to cause a lot of edge cases like this, and I don't know that there is a good generic fix for it beyond just addressing them as they come up.