eclipse xml 编辑器缩进使用空格

eclipse xml editor indent using spaces

我的eclipse版本是Mars Release (4.5.0).Preferences->XML->XML Files->Editor,无法设置Indentation size的值。 “+”和“-”是不能点击的。我还不能输入值!

有同样的问题,我找到了以下解决方法:

  1. 在您的工作区文件夹中使用文本编辑器打开此文件: .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.wst.xml.core.prefs
  2. 更改或添加以下行(“4”只是一个示例):indentationSize=4
  3. (重新)启动 Eclipse

这是 Eclipse 中的一个已知错误。它与 GTK3 相关:https://bugs.eclipse.org/bugs/show_bug.cgi?id=428246

它最初是在 2014 年初为 Kepler 版本报道的。

除了 Kollgandren 的回答之外,如果您想使用空格作为缩进,请在 ${WORKSPACE}/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.wst.xml.core.prefs 文件中包含两个选项。

indentationChar=space
indentationSize=4