开发者

Eclipse: auto format XML files on save

Is it possible to somehow auto-format when saving XML files in Eclipse?

I know it's possible to do it for Java files, but I would like it to happen for XML files as well.

开发者_如何学Python

Specifically, I'm using and loving the auto format feature for XML files while developing for Android, as Android is quite heavy on using XML files.


For eclipse auto-format try Ctrl+Shift+F


I'm going to answer my own question using my own article about the fix that's about to be rolled out to ADT: http://www.androidpolice.com/2010/11/09/for-android-developers-next-version-of-eclipse-adt-to-include-auto-formatting-of-xml/

Update: since r14, ADT can now finally do this. http://tools.android.com/recent/xmlformatter


It's been requested in WTP (bug 221696), but for now increasing the formatter's quality and speed in general has a higher priority.


Here are a few related Eclipse bugs I found. Please vote for them if auto-save for XML files and project specific XML formatting settings are important to you.

  • 195063 [api][clean up] Add Clean Up on Save
  • 221696 [formatting] Format on save
  • 248896 [preferences] Support per-project configuration for JSP/XML/HTML formatting settings
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜