benjamn / recast

JavaScript syntax tree transformer, nondestructive pretty-printer, and automatic source map generator
MIT License
4.99k stars 350 forks source link

Support a printing option to split function arguments onto multiple lines when the line is long #205

Open dalongi opened 9 years ago

dalongi commented 9 years ago

I recently used jscodeshift to add an additional argument to many function calls. Even when specifying wrapColumns, the function was still printed as one very long line instead of split over many lines.

It would be nice to have a way to have wrapColumns respected for functions with many arguments.

CC @cpojer

benjamn commented 9 years ago

Just to make sure: is there any chance this could be explained by the accidental use of options.wrapColumns instead of options.wrapColumn?

dalongi commented 9 years ago

Yes, sorry, that was just a typo in the description. Live example: http://felix-kling.de/esprima_ast_explorer/#/Ba4MGXTGGN/2

dalongi commented 9 years ago

I looked into this a little bit to see if there is a simple fix. I figured out the first one, but don't know how to approach the 2nd.