java - Idea的foreach默认foreach补全产生换行,怎么设置?
伊谢尔伦
伊谢尔伦 2017-04-18 09:04:20
0
3
831

之前老版本的Idea貌似没这个问题,升级到2016.1版本之后,foreach补全,默认变成下面的格式,如何让foreach迭代循环后面不换行?

看了下Live template里面没有这个配置的地方

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(3)
伊谢尔伦

This is not a problem, right? Enter foreach后回车,确实是换行的格式,但此时输入焦点处于:左边,并有红色竖线提示,完整输入左边部分后(如int aa) and press Enter. The line break after the colon will be automatically canceled. The input focus jumps to after the colon, and then enter the remaining content. See the picture:

In addition, the smarter foreach auto-completion can be done by typing iterEnter, the content to the left of the colon will be automatically filled in, and the input focus is on the right of the colon:

If you want the first completion method to have no line break format, you can set it here and remove the check mark in front of Reformat according style:


IntelliJ IDEA 2016.1.2

PHPzhong

When using foreach, type iter itar directly in the editor and add tab and foreach will appear

洪涛

OK, I found the method. In the edit live template, just check the ensure to style option

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template