I just wrote this line:
HDF5CompoundDSBridgeBuilder<WritableDataPoint> actualBridgeBuilder = new HDF5CompoundDSBridgeBuilder<>(actualReader);
and the automatic reformatter gave me:
HDF5CompoundDSBridgeBuilder<WritableDataPoint> actualBridgeBuilder = new HDF5CompoundDSBridgeBuilder<>
(actualReader);
I think this looks extremely strange and I want to tell IntelliJ to never put parameters on a line of their own. I'd like:
HDF5CompoundDSBridgeBuilder<WritableDataPoint> actualBridgeBuilder = new HDF5CompoundDSBridgeBuilder<>(
actualReader);
or better yet:
HDF5CompoundDSBridgeBuilder<WritableDataPoint> actualBridgeBuilder =
new HDF5CompoundDSBridgeBuilder<>(actualReader);
I'm looking through the project settings under Code Style > Java > Wrapping and Braces but I'm not sure what 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 multiline statements. I don't see any other options I could change.
Can this be done?
EDIT: If anyone wants to test on their own IntelliJ, I have my margins set to 120 characters, and the exact line (with the correct amount of whitespace -- 8 spaces) is:
HDF5CompoundDSBridgeBuilder<WritableDataPoint> actualBridgeBuilder = new HDF5CompoundDSBridgeBuilder<>(actualReader)
To disable hints completely, uncheck Settings → Editor → General → Appearance → Show parameter name hints.
Add program argumentsFrom the main menu, select Run | Edit Configurations or choose Edit Configurations from the run/debug configurations selector on the toolbar. In the Run/Debug Configurations dialog that opens, select a configuration where you want to pass the arguments.
View parameter hints in the editorOpen the Settings/Preferences dialog ( Ctrl+Alt+S ) and go to Editor | Inlay Hints | <required language>. Select Parameter hints from the list, make sure the Show parameter hints checkbox is selected, and then specify the context where you want parameter hints shown.
The setting that is causing the wrapping to occur is Code Style > Java > [Wrapping and Braces] > "Method call arguments". You can set to "Do not wrap" if you do not want it wrapped. For wrapping, set to "Wrap if Long" or "Chop down if long". Watch the foo1
method in the sample code to see the difference between wrap and chop.
Wrap:
wrapped(
0x0051, 0x0052, 0x0053,
0x0054, 0x0055, 0x0056,
0x0057);
Chop:
chopped(
0x0051,
0x0052,
0x0053,
0x0054,
0x0055,
0x0056,
0x0057);
To get your first choice, such that the '(' is kept with the method call (or constructor call in this case), set the "new line after '('" option. That will give you:
HDF5CompoundDSBridgeBuilder<WritableDataPoint> actualBridgeBuilder = new HDF5CompoundDSBridgeBuilder<>(
actualReader);
To get your second "or better yet" option, set Code Style > Java > [Wrapping and Braces] > "Assignment Statements" to "Wrap if long", "Chop if long" or "Wrap always". Set to "Wrap if long" you will get:
HDF5CompoundDSBridgeBuilder<WritableDataPoint> actualBridgeBuilder =
new HDF5CompoundDSBridgeBuilder<>(actualReader);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With