escodegen icon indicating copy to clipboard operation
escodegen copied to clipboard

make array generation configurable (fixes #260)

Open d-rk opened this issue 4 years ago • 0 comments

Hey,

this PR makes the array generation configurable (fixes #260). it introduces three new configuration parameters:

format: {
  arrays: {
    # after 'maxElementsPerLine' elements a newline will be inserted
    maxElementsPerLine: 1,
    
    # if the line would exceed `maxLineWidth`, a newline is inserted before the element
    maxLineWidth: 80
    
    # if an array does not fit into a single line, but the first element should directly follow
    # the opening bracket of the array without linebreak, set this to true
    multilineArrayStartsInline: false,
  }
}

The chosen defaults will only change the generation of arrays (compared to current master branch) if maxLineWidth is exceeded.

d-rk avatar Mar 16 '21 12:03 d-rk