views:

164

answers:

3

I find that the Eclipse XML editor always inserts tabs for spaces even if you have the "Insert spaces 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?

+4  A: 

Go to Windows > Preferences > XML > XML Files > Editor and select Indent using spaces:

alt text

Pascal Thivent
Thanks Pascal, as usual, your advice is spot on :)
dcp
+1  A: 

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.

Jason Gritman
Thanks for the tip on the plugin.
dcp
A: 

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)

euzuro