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

Improve printing for lambda arguments #672

Open
belav opened this issue May 22, 2022 · 4 comments
Open

Improve printing for lambda arguments #672

belav opened this issue May 22, 2022 · 4 comments

Comments

@belav
Copy link
Owner

belav commented May 22, 2022

There are improvements that could be made to printing arguments, namely with lambdas as parameters. #669 stuck to just improving some simple cases (single arguments or parenthesized lambdas with no arguments). Prettier has more complicated logic that we should look into.

A simple lambda with too long of an argument name + a block doesn't break when it should.
Simple lambdas with no block.
Parenthesized lambdas with no block.
Parenthesized lambdas with arguments.

@belav belav changed the title Improve printing for arguments Improve printing for lambda arguments Nov 26, 2022
@belav
Copy link
Owner Author

belav commented Nov 26, 2022

Some examples

            builder.Entity<IdentityUserToken<string>>(b =>
            {
                b.HasKey(
                    l =>
                        new
                        {
                            l.UserId,
                            l.LoginProvider,
                            l.Name
                        }
                );
                b.ToTable("AspNetUserTokens");
            });

                table.PrimaryKey(
                    "PK_AspNetUserTokens",
                    x =>
                        new
                        {
                            x.UserId,
                            x.LoginProvider,
                            x.Name
                        }
                );

@belav
Copy link
Owner Author

belav commented Nov 26, 2022

this may be more because of breaking with the new { } stuff that came from #755

builder.Entity<EntityWithThreeProperties>(e =>
                {
                    e.HasIndex(
                        t =>
                            new
                            {
                                t.X,
                                t.Y,
                                t.Z
                            },
                        "IX_unspecified"
                    );
                    e.HasIndex(
                            t =>
                                new
                                {
                                    t.X,
                                    t.Y,
                                    t.Z
                                },
                            "IX_empty"
                        )
                        .IsDescending();
                    e.HasIndex(
                            t =>
                                new
                                {
                                    t.X,
                                    t.Y,
                                    t.Z
                                },
                            "IX_all_ascending"
                        )
                        .IsDescending(false, false, false);
                    e.HasIndex(
                            t =>
                                new
                                {
                                    t.X,
                                    t.Y,
                                    t.Z
                                },
                            "IX_all_descending"
                        )
                        .IsDescending(true, true, true);
                    e.HasIndex(
                            t =>
                                new
                                {
                                    t.X,
                                    t.Y,
                                    t.Z
                                },
                            "IX_mixed"
                        )
                        .IsDescending(false, true, false);
                });

@belav
Copy link
Owner Author

belav commented Dec 8, 2022

class ClassName
{
    void MethodName()
    {
        var searchRequest = new SearchDescriptor<ElasticsearchProduct>().WithAggregations(
            o =>
                o.WithFilter(
                    key,
                    f =>
                        f.WithFilter(fd => filter)
                            .WithAggregations(
                                ad =>
                                    ad.WithTerm(
                                        key,
                                        cd =>
                                            cd.WithField(facetField).WithSize(MaximumCategoryFacets)
                                    )
                            )
                )
        );
    }
}

@aradalvand
Copy link

This keeps getting postponed... :(

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

No branches or pull requests

2 participants