Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs caused by new formatting of lambda expressions #1077

Closed
Rudomitori opened this issue Dec 18, 2023 · 2 comments
Closed

Bugs caused by new formatting of lambda expressions #1077

Rudomitori opened this issue Dec 18, 2023 · 2 comments

Comments

@Rudomitori
Copy link
Contributor

The new formatting implemented in #1066 have brought several new bugs.

First

An empty argument list is splitted to several lines if the closing bracket is exactly the 100th character of the line

Input:

private static readonly ModelBinderProviderCollection _providers =
    CreateDefaultCollection();

Output:

private static readonly ModelBinderProviderCollection _providers = CreateDefaultCollection(

);

Expected behavior:

private static readonly ModelBinderProviderCollection _providers =
    CreateDefaultCollection();

Second

In an argument list with one lambda the closing bracket is moved to the next line if it's exactly the 100th character of the line

Input:

                            It.Is<ExceptionLoggerContext>(
                                c => c.ExceptionContext == expectedContext
                            )

Output:

                            It.Is<ExceptionLoggerContext>(c => c.ExceptionContext == expectedContext
                            )

Expected behavior:

                            It.Is<ExceptionLoggerContext>(c =>
                                c.ExceptionContext == expectedContext
                            )

Third

An argument list with a lambda is incorecctly formatted if the lambda contains other nested argument list with a lambda

Input:

        this.Where______________________________________(
            selector: static longName_________________ =>
            {
                return Method(x => x.Prop);
            }
        );

Output:

        this.Where______________________________________(
            selector: static longName_________________ =>
            {
                return Method(x => x.Prop);
            });

Expected behavior:

        this.Where______________________________________(
            selector: static longName_________________ =>
            {
                return Method(x => x.Prop);
            }
        );
@Rudomitori
Copy link
Contributor Author

@belav
I've fixed the first and third buhs, but I need more time to fix the second

@belav
Copy link
Owner

belav commented Dec 21, 2023

@Rudomitori thanks for taking care of all of these!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants