Java Code Style Method Call Arguments Chop Down if Long all but first

Sorry for the long discussion title but my question is: Is there a way to prevent the first method call argument from being wrapped when you set chop down if long for method call arguments in the Java Code Style wrapping and braces options. I thought this option existed in IntellIj Ultimate 10.5, but I don't see it in IntellIj 11 Ultimate. Any help would be appreciated.

3 comments

In the code style settings, expand the "Method call argument" node where you set the chop setting. There is an option "New line after ')'".  Unchecked that option.

0

I only see the following options under the method call arguments code style tree:

- Align when multiline
- Take priority over call chain wrapping
- New line after '('
- Place ')' on new line

None of these options are selected, and I still see code fragments such as:

 assertTrue(
      "This is the first argument and I'd like it to be on the same line as the method call but I don't see a setting to force it if it's longer than the wrap column",
      "this arg I actually want to be chopped down");

0

Sorry, I did mean the "New line before '('" option. I had a typo in my first response.

To the best of my knowledge, there is no "always keep the first argument on the same line" option with chopping.  (Just the opposite to always put the first argument on the next line via the "New line before '('" option.) Per the help guide, chop down is defined as:

Chop down if long - select this option to have elements in lists that go beyond the right margin wrapped so that there is one element per line with proper indentation.

So if the first argument exceeds the column width, it gets wrapped. You could submit a feature request for an option to always keep the first argument on the same line as the method call: http://youtrack.jetbrains.net/issues/IDEA  In the meantime, your only option would be to make your right margin wider.

0

Please sign in to leave a comment.