We take a similar strategy as we do for adding commas: rather than calling renderIndent immediately after opening a new array/dict and at visitEnd, we instead set an indentBuffered flag and defer the renderIndent until later. Then each flushBuffer call can render the indent where necessary, and visitEnd can perform some additional checks that the collection is not empty before rendering the final indent
Added some basic tests to ExampleTests.scala, since some of this behavior is probably worth showing to users in the documentation
Fixes https://github.com/com-lihaoyi/upickle/issues/499
We take a similar strategy as we do for adding commas: rather than calling
renderIndent
immediately after opening a new array/dict and atvisitEnd
, we instead set anindentBuffered
flag and defer therenderIndent
until later. Then eachflushBuffer
call can render the indent where necessary, andvisitEnd
can perform some additional checks that the collection is not empty before rendering the final indentAdded some basic tests to
ExampleTests.scala
, since some of this behavior is probably worth showing to users in the documentation