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 making list formatting closer to attrsets #136

Closed
RuRo opened this issue Oct 15, 2023 · 1 comment
Closed

Consider making list formatting closer to attrsets #136

RuRo opened this issue Oct 15, 2023 · 1 comment

Comments

@RuRo
Copy link

RuRo commented Oct 15, 2023

Description

Currently, lists are formatted quite differently compared to attrsets. I think, that most of the arguments for why attrsets are formatted the way they are, apply equally well to lists. Therefore, lists should be formatted in a way similar to attrsets.

Small example input

{
  attrset = { first = 1; second = 2; };

  list = [ "first = 1" "second = 2" ];

  longer_list_name = [ "this is" "a list that" "is barely longer" "than one line" ];
}

Expected output

{
  attrset = {
    first = 1;
    second = 2;
  };

  list = [
    "first = 1"
    "second = 2"
  ];

  longer_list_name = [
    "this is"
    "a list that"
    "is barely longer"
    "than one line"
  ];
}

Actual output

{
  attrset = {
    first = 1;
    second = 2;
  };

  list = [ "first = 1" "second = 2" ];

  longer_list_name =
    [ "this is" "a list that" "is barely longer" "than one line" ];
}

P.S. The ugly line break after longer_list_name = is actually a slightly more general problem that doesn't only affect lists, but also other elements that nixfmt doesn't "want"/know how to split. I'll be opening a separate issue for that problem shortly.

@piegamesde
Copy link
Member

This should be fixed in #118

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