How to customize code auto-format feature of IntellijIDEA?

已回答

I like my curly braces to be in their own line instead of appending them at the end of method signature - I think the code looks cleaner that way. But if I use auto-format feature, by pressing Ctrl + Alt + L, on intellijIDEA, it place the curly braces back to the end of method signature.

How can I customize the auto-format feature of intellijIDEA to my liking?

IntelliIDEA auto-format(curly braces are appends at the end of method signature/class name),

public class MainApp {
public static void main(String[] args) {
System.out.println("Hello World");
}
}

My desired auto-format output(curly braces are on their own line),

public class MainApp 
{
public static void main(String[] args)
{
System.out.println("Hello World");
}
}

 

0

Hello,

You could configure it under "Braces placement" section in "Settings | Editor | Code  Style | Java - Wrapping and Braces"

 

1
Avatar
Permanently deleted user

Thank you, that worked!

0

You are welcome!

0

请先登录再写评论。