eclipse xml 编辑器为空格插入制表符
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2419584/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
eclipse xml editor inserts tabs for spaces
提问by dcp
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
.
我发现 EclipseXML
编辑器总是为空格插入制表符,即使您在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).
您可以打开任何XML
文件,然后CTRL-SHIFT-F
对文件进行格式化,您将看到这种行为(所有空格都将在适当的情况下替换为制表符)。
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.
我注意到 Ganymede 的这种行为,今天刚刚升级到 Galileo 并希望它得到修复,但它似乎是一样的。
Is this a bug, or am I doing something incorrectly?
这是一个错误,还是我做错了什么?
回答by Pascal Thivent
回答by Jason Gritman
Not sure about this issue with the XML editor specifically, but I use the AnyEdit tools pluginto handle any tabs/spaces issues.
不确定 XML 编辑器的具体问题,但我使用AnyEdit 工具插件来处理任何制表符/空格问题。
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.
安装插件后,转到首选项 -> 常规 -> 编辑器 -> AnyEdit 工具,您可以在保存文件时启用制表符到空格的自动转换(反之亦然)。我发现这非常有用,因为它还会修复您在更改这些文件时不小心插入标签的任何文件。
This plugin also provides a nice set text functions to use in the 'Convert' section of the right click menu of any text editor.
这个插件还提供了一个很好的文本函数集,可以在任何文本编辑器的右键菜单的“转换”部分中使用。
回答by euzuro
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):
这个问题的一个附录,如果你在 XML 编辑器中进行多行缩进,你就不走运了(你会得到制表符):
https://bugs.eclipse.org/bugs/show_bug.cgi?id=168988
https://bugs.eclipse.org/bugs/show_bug.cgi?id=168988
(Reported bug in Eclipse, but marked as WON'T FIX)
(在 Eclipse 中报告错误,但标记为 WON'T FIX)