belav / csharpier

CSharpier is an opinionated code formatter for c#.
https://csharpier.com
MIT License
1.39k stars 94 forks source link

Formatting Changes in Invocation Chains After Version 0.27.1 #1298

Open ludlyl opened 4 months ago

ludlyl commented 4 months ago

Input:

var couponCampaign = await dbContext.CouponCampaigns
            .Where(c => c.Claims!.All(cl => cl.UserId != userId))
            .Where(c => c.StartDate >= DateTimeOffset.UtcNow)
            .FirstOrThrowAsync(c => c.Id == couponCampaignId);
var couponCampaign = await dbContext
            .CouponCampaigns
            .Where(c => c.Claims!.All(cl => cl.UserId != userId))
            .Where(c => c.StartDate >= DateTimeOffset.UtcNow)
            .FirstOrThrowAsync(c => c.Id == couponCampaignId);

Output:

var couponCampaign = await dbContext
            .CouponCampaigns.Where(c => c.Claims!.All(cl => cl.UserId != userId))
            .Where(c => c.StartDate >= DateTimeOffset.UtcNow)
            .FirstOrThrowAsync(c => c.Id == couponCampaignId);

Expected behavior:

The formatting should allow the previous styles, preserving readability and the structured line breaks.

Is there any way to go back to one of the old styles without downgrading the version?

belav commented 4 months ago

Is there any way to go back to one of the old styles without downgrading the version?

There is no way to do that.

This change may have been an unintended side effect of something else that got fixed, I'll take a look at it.