Intellij Formatter keeps moving method level annotation and method signature in one line

不羁的心 提交于 2020-01-06 05:53:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!