Chop one argument, chop them all

Answered

I'm a line chopper when it comes to code styling. I like the "Chop if long" setting, but what I can't seem to find is a way to request, "If you chop the arguments, continue to chop ALL of the argument for that method call (or parameter list)"

Otherwise, you end up with a strange formatting, where the first argument might be chopped, then the next N arguments are on a single line. That's pretty ugly.

3
5 comments

What language are you working with? Can you provide a sample code and the expected/actual result? Thanks.

E.g. for java it work for me: It always chops down the next method argument if the line exceeds right margin ("too long") - so that there is one element per line with proper indentation.

0
Avatar
Permanently deleted user

Hey Andrey,

Language is Java. What I'd like to see is this:

methodCall(Arg1 arg1, Arg2 arg2, Arg3 arg3, Arg4 arg4)
methodCall(
    Arg1 arg1,
  Arg2 arg2,
    Arg3 arg3,
    Arg4 arg4)

The chopping occurs, but it stops as soon as the next line of arguments does not hit the right margin.

Same concept for method definitions as well (the parameter list).

0

What options do you have for Preferences | Editor | Code Style | Java | Wrapping and Braces | Method declaration parameters? With Chop down if long it reformats as you describe for me.

If issue remains, provide your exported code style Scheme please.

0

I'm looking for the same settings, and I don't seem to find. Did you manage to find a solution for this Andrey Dernov?
Basically what I'm looking for is "Chop once, chop always" or "wrap once, wrap always". It's weird that IntelliJ doesn't provide this setting.

0
Avatar
Sergei Riabinin

As mentioned above, with 'Preferences | Editor | Code Style | Java | Wrapping and Braces | Method declaration parameters' set to 'Chop down if long' or 'Wrap always' the code after applying formatting will look like:

void boo(String s,
String s1,
String s2) {

}

Is this what you are looking for, or do you speak about some different formatting?

0

Please sign in to leave a comment.