This is a feature request:
When wrapping long lines it is often desirable to wrap them downward based on the first argument. For example (in C++):
std::vector<int> functionFoo(apples, bananas, pears, strawberries, mangos) { ... }
If the line is too long even with just one argument they all drop down and indent to the indent level:
std::vector<int> functionFooLongEnoughToMakeOneArgumentTooMany( apples, bananas, pears, strawberries, mangos) { ... }
It would be great if there was an option for this.
--wrap-arguments-vertically
We use this style in C++, Scala, and Python and find it to be very readable.
Thanks!
-Darin
I'd like Artistic Style to support this formatting also for normal-length function names. I think that this is currently not possible, or am I overlooking the right options?
You can increase the line length used with max-instatement-indent=###.
Does this fix the problem or are you talking about something else?
max-instatement-indent
must be a value between 40 and 120. I'd like to have arguments, enumerators, initialisers uniquely aligned at one to three indent levels. I don't see the (maybe good) reason for having the first of it attached...Last edit: w-peuker 2015-05-05
JIm, is that aimed at me or w-peuker? By the way, AStyle is great! So thanks for that.
I guess I don't understand the problem.
AStyle aligns vertically unless the line is too long.
I need to see more examples of what you want.
Of course. Given the following code:
Or this code:
With this option, would yield the following (basically if any argument has to wrap, wrap them all):
If the function name plus any argument's length is over the specified max width, then drop them all down below the function and indent to the indent size.
This same methodology can be used when calling functions. I hope I'm understanding what you need. This could surely be a case of not knowing how to get astyle to do what I want it to. I tried the max-instatement-indent option with no luck, unfortunately.
My full set of options used:
Interestingly, Darin and I seem to talk of the same thing. Artistic style is by default quite artistic in formatting wrapped arguments and indeed: the results look nice. The requested feature would add a simplistic option. What I dislike about the artistic formatting is that changing a function name has a bigger impact on diffs which makes reviewing changes slightly harder (because of the worse signal-to-noise ratio).
Ticket moved from /p/astyle/bugs/359/
Hello @JimPattee, I was looking for this too and found my self needing to register and asking if it's already implemented and I'm not aware of the right option for this?
Would really appreciate hearing from you.
Thanks a lot for the amazing work you did here! and of course the contributors to this project!
This has not been implemented.
Thanks for info Jim! Hopefully I'll have time at some point looking into this.