[英]Phpstorm doesn't indent new lines on enter
Code inside <?php ?>
doesn't always get indented in PhpStorm. <?php ?>
中的代码并不总是在PhpStorm中缩进。 It acts like this: 它的行为如下:
<?php
echo 's';//PRESS ENTER
//caret jumps here
if($boolean){//PRESS ENTER
//caret jumps here(as expected)
}
?>
How to fix this? 如何解决这个问题?
By default, PHP code is only indented in a code block ( {...}
or an array definition, like array(...)
). 默认情况下,PHP代码仅在代码块(
{...}
或数组定义(如array(...)
)中缩进。 In other words, by default, PHPStorm formats code like this: 换句话说,默认情况下,PHPStorm格式化代码如下:
<?php
echo 's';//PRESS ENTER
//caret jumps here
if($boolean){//PRESS ENTER
//caret jumps here(as expected)
}
?>
To make it indent inside the <?php ... ?>
tags, go to Preferences > Editor > Code Style > PHP > Other and check "Indent code in PHP tags", like this: 要在
<?php ... ?>
标记内缩进,请转到“首选项”>“编辑器”>“代码样式”>“PHP”>“其他”,然后选中“在PHP标记中缩进代码”,如下所示:
You can see both the check box and the resulting formatting in the image above. 您可以在上图中看到复选框和结果格式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.