Open
Description
Perhaps this is working as intended, but I found it quite surprising and it took some trial and error to see what exactly the fmt is focusing on. Both of the below snippets are how jsonnetfmt with no flag overrides chooses to format the code:
local A = {
foo: true,
} + {
bar: true,
};
local B = {
foo: true,
} +
{
bar: true,
};
true
The key difference is whether we join the two objects with } + {
or insert a newline before the {
. This can produce some massive horizontal indentation in some nested object definitions as it tries to align everything on the first opening {
.
I guess the positive is that you can control this yourself by keeping the {
on the same line but it still feels like not a very useful formatted output.