You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've found that in formatting source code, you often want to have delimiters (such as commas etc). But you often also have other items in the list for which there should not be any delimiters (comments etc). They should "break" just like any other item in the list, and a break of one item in the list should imply the break of every item in the list equally - but some of these items should not have delimiters after them.
You'd like to separate each object key/value pair with a comma, but you want the comments before each key-value pair to break along with each of the items (as follows):
I'll try to share my solution, but the downside is that in order to get the comments to break as regular list items would, you have to forgo the separators and hand roll them yourself - placing each one manually. This could be in a helper library, but I like that Easyformat accepts separators "declaratively" and handles their placement. It's not just about convenience. I suspect there are certain things that only Easyformat could possibly be in the position to do. For example, imagine a separator rule that only places the trailing separator if the line actually breaks - that kind of "dry run/propagating" logic sounds similar to what the BreakAlways_rec feature required.
Anyways, in the absence of features such as "trailing separator only if line breaks", I believe you are correct that this can be in a helper library.
I've found that in formatting source code, you often want to have delimiters (such as commas etc). But you often also have other items in the list for which there should not be any delimiters (comments etc). They should "break" just like any other item in the list, and a break of one item in the list should imply the break of every item in the list equally - but some of these items should not have delimiters after them.
You'd like to separate each object key/value pair with a comma, but you want the comments before each key-value pair to break along with each of the items (as follows):
So the comments have spaces separating them from any other key-value pair in the sequence, but should be immune to any delimiters.
My only solution was to create this intermediate representation (wrapping EasyFormat) but that was so cumbersome.
The text was updated successfully, but these errors were encountered: