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

Nested Fluent API produces wrong code: misses indentation #1804

Closed
1 of 3 tasks
alfonsogarciacaro opened this issue Jul 2, 2021 · 3 comments · Fixed by #1809
Closed
1 of 3 tasks

Nested Fluent API produces wrong code: misses indentation #1804

alfonsogarciacaro opened this issue Jul 2, 2021 · 3 comments · Fixed by #1809

Comments

@alfonsogarciacaro
Copy link
Contributor

Issue created from fantomas-online

Code

db.Schema.Users.Query
    .Where(fun x -> x.Role)
    .Matches(function Role.User companyId -> companyId |_->__)
    .In(
        db.Schema.Companies.Query
            .Where(fun x -> x.LicenceId).Equals(licenceId)
            .Select(fun x -> x.Id)
    )

Result

db
    .Schema
    .Users
    .Query
    .Where(fun x -> x.Role)
    .Matches(function
    | Role.User companyId -> companyId
    | _ -> __)
    .In(db
        .Schema
        .Companies
        .Query
        .Where(fun x -> x.LicenceId)
        .Equals(licenceId)
        .Select(fun x -> x.Id))

Problem description

Nested fluent APIs (a fluent API passed as argument to another fluent API) seem to produce wrong code. In the sample above the second .Schema (and the lines below) need to be indented further than db. The error repeats after manual fixing and it also breaks the cli tool.

Extra information

  • The formatted result breaks by code.
  • The formatted result gives compiler warnings.
  • I or my company would be willing to help fix this.

Options

Fantomas Master at 07/01/2021 18:56:12 - 3a12872

Default Fantomas configuration

Did you know that you can ignore files when formatting from fantomas-tool or the FAKE targets by using a .fantomasignore file?

@nojaf
Copy link
Contributor

nojaf commented Jul 2, 2021

Thanks for reporting this.

@alfonsogarciacaro
Copy link
Contributor Author

Thanks to you @nojaf, fantomas is getting better and better! I'm starting to use it regularly in my projects 👍

@nojaf
Copy link
Contributor

nojaf commented Jul 3, 2021

That is wonderful news!

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

Successfully merging a pull request may close this issue.

2 participants