LnL7 / vim-nix

Vim configuration files for Nix http://nixos.org/nix
MIT License
287 stars 26 forks source link

Invalid indentation when `let` is on independent line #30

Open Slabity opened 4 years ago

Slabity commented 4 years ago

Take a look at how vim-nix indents this code:

rec {
  test = let
    var = "value";
  in
  {
    inner_var = var;
  };
}

The indentation is correctly applied above. However, if the let keyword is given an independent line:

rec {
  test =
    let
      var = "value";
    in
    {
      inner_var = var;
    };
  }

You can see that the braces are not indented properly. This cascades further each time a let keyword is given its own line, which can make valid Nix look like this:

rec {
  testA =
    let
      var = "value";
    in
    {
      inner_var = var;
    };

    testB =
      let
        var = "value";
      in
      {
        inner_var = var;
      };

      testC =
        let
          var = "value";
        in
        {
          inner_var = var;
        };

        testD =
          let
            var = "value";
          in
          {
            inner_var = var;
          };
        }