Skip to content

[REGRESSION] long lines are wrapped at empty lists #268

@MattSturgeon

Description

@MattSturgeon

Description

When an empty list is within a long line, it is used as a "good place" to insert line breaks. Previously this was not the case, and parentheses would be used instead.

Note, this seems to affect lists but not attrsets.

Somewhat related to #265, originally spotted in the wild nix-community/nixvim#2209 (comment)

Small example input

{
  config_file_path = defaultNullOpts.mkNullable (with types; either str (listOf str)) [] "Some example long text that causes the line to be too long.";
  other_example = defaultNullOpts.mkNullable (with types; either str (listOf str)) {} "Some example long text that causes the line to be too long.";
}

Expected output

(previous behavior)

{
  config_file_path = defaultNullOpts.mkNullable (
    with types; either str (listOf str)
  ) [ ] "Some example long text that causes the line to be too long.";
  other_example = defaultNullOpts.mkNullable (
    with types; either str (listOf str)
  ) { } "Some example long text that causes the line to be too long.";
}

Actual output

{
  config_file_path = defaultNullOpts.mkNullable (with types; either str (listOf str)) [
  ] "Some example long text that causes the line to be too long.";
  other_example = defaultNullOpts.mkNullable (
    with types; either str (listOf str)
  ) { } "Some example long text that causes the line to be too long.";
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions