Skip to content

Weird indentation after alignment #373

Open
@sbarzowski

Description

@sbarzowski

This code is formatted with jsonnet fmt:

local stringToInt(s) =
  local zeroCodepoint = std.codepoint("0"),
        stringToIntHelper(s, idx, acc) =
    if idx == std.length(s) then // see what happened here?
      acc
    else
      local digit = std.codepoint(s[idx]) - zeroCodepoint;
      stringToIntHelper(s, idx + 1, acc * 10 + digit);
  stringToIntHelper(s, 0, 0);
stringToInt("42")

A simpler artificial example:

local xxxxxxxxxxxxxxxxxxxx = 42,
      yyyyyyy =
  {
    something_long: 42,
  };
true

So if there are multiple binds in a local, and one of them has a body starting on a new line, that body gets weirdly dedented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions