Skip to content

[Bug]: if/else processor directive messes up indentation #1853

Open

Description

@sd-st

Description

Here's a random example:
Image

I would really like the .ReadAsStringAsync() calls to line up. This seems related to #664 although this specific edge-case seems a lot easier to solve, since we know the #if and #else can't be active at the same time.

Steps to Reproduce

Format this code with csharpier:

{
var longvariablename = await thingy
.Content
#if NET
.doTheNetThing(wouldyoustilllovemeifiwasaworm)
#else
.doTheNotNetThing()
#endif
.Finish();
}

Actual Behavior

{
    var longvariablename = await thingy
        .Content
#if NET
        .doTheNetThing(wouldyoustilllovemeifiwasaworm)
#else
    .doTheNotNetThing()
#endif
        .Finish();
}

Expected Behavior

{
    var longvariablename = await thingy
        .Content
#if NET
        .doTheNetThing(wouldyoustilllovemeifiwasaworm)
#else
        .doTheNotNetThing()
#endif
        .Finish();
}

Activity

  1. belav commented on Apr 23, 2026

    @belav
    Owner

    I'm guessing that the changes from #1676 may take care of this. Based on which branch of the #if is active the invocation chain formats differently. #1676 may get those two branches consistent.

  2. github-actions commented on Jul 23, 2026

    @github-actions

    This issue is stale because it has been open 90 days with no activity and was not assigned a label or milestone. Leave a comment if this still needs to be addressed or this will be closed in 7 days.

  3. added this to the 1.4.0 milestone on Jul 23, 2026
  4. modified the milestones: 1.4.0, 1.5.0 on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions