google / google/jsonnet

Weird indentation after alignment

Open
#373 0 comments 0 reactions 0 assignees View on GitHub
formatter
Dominant language
Jsonnet
Stars
7.6k
Forks
475
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.