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

multiline inherit reads poorly #367

Open
colin-arnott-xero opened this issue Dec 12, 2022 · 0 comments
Open

multiline inherit reads poorly #367

colin-arnott-xero opened this issue Dec 12, 2022 · 0 comments
Labels
component | style Modifications to the formatting rules roadmap | style config status | it is a good thing We agree it is good to implement this type | feature request New feature or request

Comments

@colin-arnott-xero
Copy link

colin-arnott-xero commented Dec 12, 2022

When writing inlined inherit statements, I find that alejandra makes them look worse than required. This is may well be controlled by rules not specific to inherit, and may read well for other space delimited syntax, but inherit always only accepts one grouping parameter in parenthesis, so maybe we can treat it specially?

given:

{
  inherit (mkFruit { a = "apple"; b = "banana"; c = "cherry"; d = "date"; e = "elderberry";}) feijoa grape honeydew;
}

I would want something like:

{
  inherit (mkFruit {
      a = "apple";
      b = "banana";
      c = "cherry";
      d = "date";
      e = "elderberry";
    }) feijoa grape honeydew;
}

Alejandra generates:

{
  inherit
    (mkFruit {
      a = "apple";
      b = "banana";
      c = "cherry";
      d = "date";
      e = "elderberry";
    })
    feijoa
    grape
    honeydew
    ;
}

Otherwise, I know this will work too:

let
  fruit = mkThing {
    a = "apple";
    b = "banana";
    c = "cherry";
    d = "date";
    e = "elderberry";
  };
in {
  inherit (fruit) fejioa grape honeydew;
}
@kamadorueda kamadorueda added type | feature request New feature or request component | style Modifications to the formatting rules status | it is a good thing We agree it is good to implement this roadmap | style config labels Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component | style Modifications to the formatting rules roadmap | style config status | it is a good thing We agree it is good to implement this type | feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants