nix-community / nixpkgs-fmt

Nix code formatter for nixpkgs [maintainer=@zimbatm]
https://nix-community.github.io/nixpkgs-fmt/
Apache License 2.0
581 stars 34 forks source link

let binding with if dedents but without if indents #249

Open jtojnar opened 3 years ago

jtojnar commented 3 years ago

Input

let
  foo = if condition then null else
    4;

in
true

Output

let
  foo = if condition then null else
  4;

in
true

Desired output

let
  foo = if condition then null else
    4;

in
true

Since if I remove the if statement, the 4 will get indented again:

let
  foo =
    4;

in
true

Noticed in nixos/modules/services/x11/display-managers/gdm.nix on https://github.com/NixOS/nixpkgs/pull/121490