本文介绍了在Eclipse中输入PHP时错误的数组初始值设定项缩进的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在首选项">"PHP">代码样式">"Fromatter">换行"上设置了首选的数组初始值设定项缩进,但是在键入数组初始值设定项缩进是错误的:

I set my preferred array initializer indentation on Preferences > PHP > Code Style > Fromatter > Line Wrapping, but while typing array initializers indentation is wrong:

$arr = array([ENTER]
····[CURSOR])

在我期望的时候:

$arr = array([ENTER]
··[CURSOR]
)

就像编辑Javascript代码一样.请注意,错误的缩进仅在键入时发生,而显式的CTRL + SHIFT + F缩进数组初始化器正确. (因此,不是其他许多询问如何设置缩进的问题的重复项,因为此处设置了缩进,但键入时不应用缩进.)

like it happens editing Javascript code. Note that the wrong indentation happens only while typing, whereas an explicit CTRL+SHIFT+F indents array initializer correctly. (So not a duplicate of many other questions asking how to set indentation, since here indentation is set but not applied while typing.)

键入数组初始值设定项时如何获得正确的缩进?

How can I get the correct indentation while typing array initializers?

推荐答案

我在Zend Eclipse for PHP Developers上的设置,位于PHP> Code Style> Formatter:

My settings on Zend Eclipse for PHP Developers, under 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
  • 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

这篇关于在Eclipse中输入PHP时错误的数组初始值设定项缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 13:23