Wrap after comma

已回答

Hello,

I have a code formatting issue. I need to set wrapping after comma if the expression is too long.

What I get at the moment:

if (softwareLicenseOpt.get().getOldKey().isPresent()) {
throw new ForbiddenException(
String.format("CASE 2.05 - wrong values, please use old key contactId %s, contractId %s and wekaNo %s.", contactId, contractId,
request.getWekaNo()));
}

What I want is:

if (softwareLicenseOpt.get().getOldKey().isPresent()) {
throw new ForbiddenException(String.format("CASE 2.05 - wrong values, please use old key contactId %s, contractId %s and wekaNo %s.", contactId,
contractId, request.getWekaNo()));
}

What do I need to set up to get the code formatted like I want?

Thanks in advance.

Greetings

Heiko

0

To set up wraps in the way you need, you can open the  File|Settings / IntelliJIDEA|Preferences  window, choose in the left menu  Editor|Code Style|Java and switch to the Wrapping and Bracers tab. For your particular case, you need to change settings in the Method call arguments paragraph.
Also, we can advise you to switch off the Line breaks option in the Keep when reformatting paragraph here. As an option, you can remove line breaks using the Code | Reformat file dialog with Do not keep line breaks turned on or by pressing twice the Reformat code shortcut.

0

请先登录再写评论。