Eclipse “Correct Indentation” ignoring spaces vs. tabs setting

断了今生、忘了曾经 提交于 2021-02-08 03:36:49

问题


I'm running Eclipse Juno Service Release 2 (20130225-0426) in Windows and I'm finding that auto-indent (Ctrl-I) ignores both the General/Editors/Text Editors/Insert spaces for tabs and Java/Code Style/Formatter/Indentation/Tab policy="Spaces only" settings. With both of those set, Ctrl-I indents the code with a combination of tabs and spaces, even though Ctrl-Shift-F uses spaces only. The problem is I don't want Eclipse to reformat my code -- just correct the indentation with spaces.

Is this a known bug or am I missing a setting somewhere? Thanks!


回答1:


It appears the "Correct Indentation" (Ctrl+I) will attempt to copy whatever indentation was used on the line of code immediately preceding your selected block. (Even if that line is using a combination of tabs and spaces!) If I select the whole file then it actually uses my preferences.

Seems pretty deliberate to be a bug though in my opinion there should at least be an option for it. I looked through the Eclipse bug tracker for a while and didn't see anything.



来源:https://stackoverflow.com/questions/17527819/eclipse-correct-indentation-ignoring-spaces-vs-tabs-setting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!