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

Consider less indentation for concatenated values #389

Open
quantenzitrone opened this issue Apr 11, 2023 · 0 comments
Open

Consider less indentation for concatenated values #389

quantenzitrone opened this issue Apr 11, 2023 · 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

@quantenzitrone
Copy link

{
  # why is the formatting like this for concatenated values:
  test =
    {
      foo = "foo";
    }
    // {
      bar = "bar";
    };
  test2 =
    ''
      foo
    ''
    ++ ''
      bar
    '';
  # but like this for let in:
  test3 = let
    foo = "foo";
    bar = "bar";
  in {
    inherit foo bar;
  };
  # ?
}

Some consistency would be nice there:

{

  test = {
    foo = "foo";
  }
  // {
    bar = "bar";
  };
  test2 = ''
    foo
  ''
  ++ ''
    bar
  '';
  test3 = let
    foo = "foo";
    bar = "bar";
  in {
    inherit foo bar;
  };
}

furthermore, if you add something to an existing single value, the diff would be cleaner:

{
  test = {
    foo = "foo";
+ }
+ // {
+   bar = "bar";
  };
}

opposed to:

{
- test = {
-   foo = "foo";
- };
+ test =
+   {
+     foo = "foo";
+   }
+   // {
+     bar = "bar";
+   };
}

obviously, this only applies to stuff that has grouping characters, like:

  • sets
  • Parenthesized function calls
  • lists
  • multiline strings

i am not really sure if and how this would be consistent with stuff that has no grouping characters, but i would also be ok with stuff like this:

let
  bar = ["bar"];
in {
  foobar = [
    "foo"
  ]
  ++ bar;
}

I'm honestly more annoyed by the extra indentation and the almost empty line with [

let
  bar = ["bar"];
in {
  foobar = 
    [
      "foo"
    ]
    ++ bar;
}
@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