google / google/jsonnet

Question about pathological indentation inside object

Open
#839 1 comment 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

I'm currently reimplementing [`jsonnet-mode`](https://github.com/tminor/jsonnet-mode)'s indentation function in an effort to follow `jsonnetfmt`'s output as closely as possible. I'm curious if the following indentation is considered correct:

```jsonnet
{
id: 1 +
2 + (
if true then
0
else
3
),
}
```

This seems more natural to me (and it's what the new indentation function yields):

```jsonnet
{
id: 1 +
2 + (
if true then
0
else
3
),
}
```

On a side note, `jsonnet-mode`'s previous maintainer recently transferred ownership to me but [https://jsonnet.org/learning/tools.html](https://github.com/google/jsonnet/blob/08875537f6e350a8d2acbd548bdd997b80cd86c9/doc/learning/tools.html#L53) points to the old location. It redirects correctly, so it probably doesn't really matter!

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.