Eclipse“正确的缩进";忽略空格与制表符设置 [英] Eclipse "Correct Indentation" ignoring spaces vs. tabs setting

查看:75
本文介绍了Eclipse“正确的缩进";忽略空格与制表符设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows中运行Eclipse Juno Service Release 2(20130225-0426),发现自动缩进(Ctrl-I)忽略了选项卡和Java/的常规/编辑器/文本编辑器/插入空间代码样式/格式化程序/缩进/制表符策略仅空格"设置.设置了这两个选项后,即使Ctrl-Shift-F仅使用空格,Ctrl-I也会使用制表符和空格的组合来缩进代码.问题是我不希望Eclipse重新格式化我的代码-只需用空格纠正缩进即可.

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!

推荐答案

似乎正确的缩进"(Ctrl + I)将尝试复制紧接所选块之前的代码行上使用的任何缩进.(即使该行使用制表符和空格的组合!)如果我选择整个文件,则它实际上会使用我的首选项.

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.

似乎很故意是个错误,尽管在我看来,至少应该有一个选择.我浏览了Eclipse bug跟踪器一段时间了,什么也没看到.

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.

这篇关于Eclipse“正确的缩进";忽略空格与制表符设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆