0

When I use uncrustify to format lines of code like:

functionCall(quiteLongAndWordyArgument1, quiteLongAndWordyArgument2, quiteLongAndWordyArgument3,
             shortArgument);

functionCall(quiteLongAndWordyArgument1, quiteLongAndWordyArgument2, quiteLongAndWordyArgument3,
             shortArgument,
             anotherShortArgument);

It produces the following:

functionCall(quiteLongAndWordyArgument1, quiteLongAndWordyArgument2,
             quiteLongAndWordyArgument3,
             shortArgument);

functionCall(quiteLongAndWordyArgument1, quiteLongAndWordyArgument2,
             quiteLongAndWordyArgument3,
             shortArgument,
             anotherShortArgument);

Note that it's maintaining some of the existing newlines that are already there, rather than completely reformatting each chunk of code and fitting the arguments into as few lines as possible.

What I'd like it to do is treat those lines as though there's no newlines in it at all, so the result would be:

functionCall(quiteLongAndWordyArgument1, quiteLongAndWordyArgument2,
             quiteLongAndWordyArgument3, shortArgument);

functionCall(quiteLongAndWordyArgument1, quiteLongAndWordyArgument2,
             quiteLongAndWordyArgument3, shortArgument, anotherShortArgument);

Is this possible?

I've searched through uncrustify's massive number of configuration options and haven't found one that helps with this yet, though of course I could easily have missed one.

Here is my current configuration in case it helps.

Bri Bri
  • 2,169
  • 3
  • 19
  • 44
  • I usually use this tool: http://astyle.sourceforge.net/ I think it can do what you want but I’m not sure. – Soonts Jan 02 '20 at 20:39
  • @Soonts I've looked into Artistic Style as well as clang-format, and along with uncrustify I'm trying to see if I can get any one of them to do precisely what I want, though so far each one of them makes formatting choices I'm not happy with. Given its massive number of options, uncrustify seems the most likely to work for me, but it still has issues such as the one I'm asking about with this question. – Bri Bri Jan 02 '20 at 20:46

0 Answers0