How can I stop IntelliJ from setting parameters on my own line?

I just wrote this line:

HDF5CompoundDSBridgeBuilder<WritableDataPoint> actualBridgeBuilder = new HDF5CompoundDSBridgeBuilder<>(actualReader); 

and the automatic reformer gave me:

 HDF5CompoundDSBridgeBuilder<WritableDataPoint> actualBridgeBuilder = new HDF5CompoundDSBridgeBuilder<> (actualReader); 

I think this looks very strange, and I want to tell IntelliJ to never put parameters on its own line. I would like to:

 HDF5CompoundDSBridgeBuilder<WritableDataPoint> actualBridgeBuilder = new HDF5CompoundDSBridgeBuilder<>( actualReader); 

or better yet:

 HDF5CompoundDSBridgeBuilder<WritableDataPoint> actualBridgeBuilder = new HDF5CompoundDSBridgeBuilder<>(actualReader); 

I look at the project options under Code Style> Java> Wrap and Brackets, but I'm not sure which option I should change. I don’t want to always have a new line after '(', I just want to make sure that IntelliJ never breaks there when it breaks multi-line expressions. I do not see any other parameters that I could change.

Can this be done?

EDIT: If someone wants to test on their IntelliJ, I have fields equal to 120 characters, and the exact line (with the correct number of spaces is 8 spaces):

  HDF5CompoundDSBridgeBuilder<WritableDataPoint> actualBridgeBuilder = new HDF5CompoundDSBridgeBuilder<>(actualReader) 
+6
source share
2 answers

The parameter that causes the wrapping is Code Style> Java> [Wrapping and Braces]> "method invocation arguments". You can set Do Not Wrap if you do not want it to be wrapped. To wrap, set the value to "Wrap if Long" or "Chop down if long." See the foo1 method in the sample code to see the difference between wrapping and beating.

Wrap:

 wrapped( 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057); 

Chop:

 chopped( 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057); 

To get your first choice, so that '(' is stored with a method call (or a constructor call in this case), set the option 'new line after' ("". This will give you:

 HDF5CompoundDSBridgeBuilder<WritableDataPoint> actualBridgeBuilder = new HDF5CompoundDSBridgeBuilder<>( actualReader); 

To get the second option, β€œor better,” set Code Style> Java> Wrap and Brackets> Assignment Statements to Wrap For Long, Drop For Long, or Wrap Always . Set the value to "Wrap if long", which you get:

 HDF5CompoundDSBridgeBuilder<WritableDataPoint> actualBridgeBuilder = new HDF5CompoundDSBridgeBuilder<>(actualReader); 
+10
source

I think this is possible because I have never seen IntelliJ do what you describe.

My IntelliJ 13.1.1 does not put parameters on a new line. When I look at Code Style-> Java in the arguments of the Method method, all the checkboxes are unchecked. See if you have one too.

0
source

Source: https://habr.com/ru/post/973313/


All Articles