Skip to content

Inconsistent formatting of single-line lambda expressions #1594

Closed

Description

@OleRoss

CSharpier 1.0.1 with a line width configured to 120

Somehow, csharpier only breaks correctly if the number of characters in the line is 123 or above. 121 or 122 seems to cause the issue.
If there are multiple lambda expressions in the method call, the line breaks as expected.

Maybe this was caused by fixing #1522.

Apart from that, thanks for all the great work, I really enjoy using csharpier :)

Input:

RegisterSomething(() => DoSomething_________________________________________________________________________________());
RegisterSomething(() => DoSomething_________________________________________________________________________________1());
RegisterSomething(() => DoSomething_________________________________________________________________________________11());
RegisterSomething(() => DoSomething_________________________________________________________________________________111());

Output:

RegisterSomething(() => DoSomething_________________________________________________________________________________());
RegisterSomething(() => DoSomething_________________________________________________________________________________1()
);
RegisterSomething(() => DoSomething_________________________________________________________________________________11()
);
RegisterSomething(() =>
    DoSomething_________________________________________________________________________________111()
);

Expected behavior:

RegisterSomething(() => DoSomething_________________________________________________________________________________());
RegisterSomething(() =>
    DoSomething_________________________________________________________________________________1()
);
RegisterSomething(() =>
    DoSomething_________________________________________________________________________________11()
);
RegisterSomething(() =>
    DoSomething_________________________________________________________________________________111()
);

Activity

  1. added this to the 1.0.2 milestone on Apr 28, 2025
  2. added 2 commits that reference this issue on May 21, 2025
    033c83f
    225120f
  3. added a commit that references this issue on May 24, 2025
    44ecdbb
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

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions