I'm pretty-printing a C++ method declaration and I want arguments list to be rendered in a compact form if it fits the line:
void method(MyLongClassName& instance, const MyClass& c);
or to be formatted in columns if it doesn't:
void method( MyLongClassName& instance,
const MyClass& c,
int counter);
all other layouts I want to eliminate from consideration. It seems to be simple neither with wl-pprint nor with pretty, if not hacking the sources.
Any ideas?
A solution to a more general problem how to choose a layout that fits to a single line or, if none, use a substitute can be found here: Optional spaces and multiple alternatives in wl-pprint-extras