Skip to content

Feature for distributing comments to lists with separators. #6

Open
@jordwalke

Description

@jordwalke

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.

 var myObject = {/*firstField */ fieldOne: blah, /*secondField */ fieldTwo: foo};

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):

 var myObject = {
   /*firstField */
   fieldOne: blah,
   /*secondField */
   fieldTwo: foo
};

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions