我在 Preferences > PHP > Code Style > Fromatter > Line Wrapping 上设置了我首选的数组初始化程序缩进,但是在键入数组初始化程序时缩进是错误的:
$arr = array([ENTER]
····[CURSOR])
在我期待的时候:
$arr = array([ENTER]
··[CURSOR]
)
就像编辑 Javascript 代码一样。请注意,错误缩进仅在键入时发生,而显式 CTRL+SHIFT+F 会正确缩进数组初始值设定项。 (因此与询问如何设置缩进的许多其他问题不重复,因为此处设置了缩进但在键入时未应用。)
如何在键入数组初始值设定项时获得正确的缩进?
最佳答案
我在 Zend Eclipse for PHP Developers 上的设置,在 PHP
下> Code Style
> Formatter
:
-
Indentation
>Tab policy
>Spaces
-
Indentation
>Indentation size
>2
-
Indentation
>Tab size
>2
-
Indentation
>Default indentation for array initializers
>2
-
Line Wrapping
>Expressions
>Array initializers
>Indentation policy
>Indent by one
关于php - 在 Eclipse 中键入 PHP 时数组初始值设定项缩进错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13108241/