之前老版本的Idea貌似没这个问题,升级到2016.1版本之后,foreach补全,默认变成下面的格式,如何让foreach迭代循环后面不换行?
看了下Live template里面没有这个配置的地方
伊谢尔伦2017-04-18 09:06:20
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 iter
Enter, 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
PHPz2017-04-18 09:06:20
When using foreach, type iter itar directly in the editor and add tab and foreach will appear
PHP中文网2017-04-18 09:06:20
OK, I found the method. In the edit live template, just check the ensure to style option