问题
I have tried several formatter settings in the IDE but I am not able to achieve following:
@Test
public void testMethod(){
..............
}
IntelliJ keeps changing above code to:
@Test public void testMethod(){
..............
}
Has anyone been able to figure this out?
回答1:
go to Settings and then go to
Editor --> Code Style --> Java ,
then switch to tab Wrapping and Braces ,
node Keep when reformatting , checkbox Line breaks .
Switch this checkbox on .
Also look at Method annotations
This screenshot is taken from Version 2018.1, but it should look similar in your version.
来源:https://stackoverflow.com/questions/50921389/intellij-formatter-keeps-moving-method-level-annotation-and-method-signature-in