Closed kay999 closed 7 years ago
Nice idea and thanks for the PR!
I think this would be really great if we could also
inlineArray
?)Maybe rename it to "inlineArrayElements" and allow using a number which is the maximum number of elements which are inlined:
inlineArrayElements= true // always inline
inlineArrayElements= 5 // only inline up to 5 elements
(or use the number of characters instead of the element count)
"only force quoted strings inside the array" would require a 2-pass algorithm to first determine if all array elements are simple values because otherwise it would also force it for non-inlined elements.
(or use the number of characters instead of the element count)
I'd go with max-line-length - indent
as the main goal is readability.
"only force quoted strings inside the array" would require a 2-pass algorithm to first determine if all array elements are simple values because otherwise it would also force it for non-inlined elements.
It might make more sense to start by creating an inline array (because you need to know the final length of the elements) and only restart with a normal array if it does not fit/qualify.
Thanks - I'm closing this in favor of the new condense api that also works on objects.
I added a simple option "inlineSimple" which formats arrays of simple values comma-separated on a single line. This can improve readability in some cases.
This
with inlineSimple=true is formatted as: