I find that the Eclipse XML
editor always inserts tabs for spaces even if you have the "Insert s开发者_StackOverflow中文版paces for tabs" option checked under Window->Preferences->General->Editors->Text Editors
.
You can open any XML
file, and then do CTRL-SHIFT-F
to format the file and you'll see this behavior (all your spaces will be replaced with tabs where appropriate).
I noticed this behavior with Ganymede, and just upgraded to Galileo today and was hoping it was fixed, but it seems to be the same.
Is this a bug, or am I doing something incorrectly?
Go to Windows > Preferences > XML > XML Files > Editor and select Indent using spaces:
Not sure about this issue with the XML editor specifically, but I use the AnyEdit tools plugin to handle any tabs/spaces issues.
Once you've installed the plugin go to Preferences -> General -> Editors -> AnyEdit Tools and you can enable auto conversion of tabs to spaces (or vice versa) whenever you save a file. I find this very useful because it will also fix any files you've accidentally inserted tabs into when you change those files.
This plugin also provides a nice set text functions to use in the 'Convert' section of the right click menu of any text editor.
Steps:
- Open
Eclipse -> Preferences
- Go to
XML -> XML Files -> Editor
- Select the
Indent using spaces
option
An addendum to this issue, if you do a multi-line indentation in an XML editor, you are out of luck (you'll get tabs):
https://bugs.eclipse.org/bugs/show_bug.cgi?id=168988
(Reported bug in Eclipse, but marked as WON'T FIX)
精彩评论