我想更改 Eclipse 格式化 XML 文件的方式。例如,如果我在 pom.xml 文件中有如下部分:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
ctrl+shift+f 后,它看起来像:
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
3.8.1
</version>
<scope>
test
</scope>
</dependency>
我更喜欢第一个版本,那么如何配置 Eclipse 将 XML 文件格式化为这样呢?
窗口 -> 首选项,然后 XML -> XML 文件 -> 编辑器。首选项树上方有一个搜索框,当您想要查找配置的位置时非常有用。
请注意,可能使用其他编辑器,例如如果您正在编辑build.xml
文件并具有 Ant 集成。在这种特定情况下,您可以在 Window -> Preferences、Ant -> Editor -> Formatter 中设置格式设置。在类似的情况下,您需要自己搜索该编辑器的相应选项。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)