PyDev 添加制表符来阻止缩进
我正在使用 Eclipse Ingigo 和 Pydev 2.3.0.2011121518,它一直工作得很好,但突然开始用选项卡做这种奇怪的事情。
我已经为 PyDev 设置了“键入时用空格替换制表符”选项 --> Eclipse 首选项中的编辑器,工作正常,当我按 Tab 时,我得到 4 个空格。然而,由于某些原因,现在当我创建一个块时,例如“if”块,pydev 会自动缩进下一行,因为它应该,但这次它添加了一个选项卡,导致“混合缩进:找到选项卡”警告。
有没有人以前见过这种行为,并且知道修复方法,或者这是 Eclipse Indigo 上 Pydev 的错误?
I am using Eclipse Ingigo with Pydev 2.3.0.2011121518, it has been working great, but has suddenly starting doing this weird thing with tabs.
I have got the "Replace tabs with spaces when typing" option set for PyDev --> Editor in Eclipse preferences, and that works fine, when I press tab, I get 4 spaces. However for some rerason, now when I create a block, such as an "if" block pydev automatically indents the next line, as it should but this time it adds a tab, leading to "Mixed Indentation: Tab found" warnings.
Has anyone seen this behavior before, and know a fix, or is it a bug with Pydev on Eclipse Indigo?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我刚刚解决了这个问题 - 我有一个选项。在 Eclipse 首选项中选中“当文件包含制表符时假定制表符间距” --> PyDev -->编辑。当我取消选中此选项时,自动缩进正常工作,并且添加了空格而不是制表符。似乎在我的一个文档字符串中我有一些制表符(可能是从另一个编辑器复制的),这一定是让 Eclipse 假定自动缩进的制表符间距(即使在我键入它们时它仍然用空格替换制表符)
I have just solved this - I had the option ."Assume tab spacing when file contain tabs" checked in Eclipse Preferences --> PyDev --> Editor. When I unchecked this option the automatic indentation worked properly and it added spaces and not tabs. It seems that in one of my docstrings I had some tabs (possibly copied in from another editor), and that must have been making Eclipse assume tab spacing for automatic indentation (even though it was still replacing tabs with spaces as I typed them)
在
mars2
和 PyDev 5.1.1 上,我仍然会遇到这种情况。我已选中在键入时用空格替换制表符
,并且在文件包含制表符时假定制表符间距
未选中。我必须用空格替换所有制表符才能删除此警告。On
mars2
and PyDev 5.1.1 this still occurs to me. I haveReplace tabs with spaces when typing
checked andAssume tab spacing when file contain tabs
unchecked. I had to replace all tabs with spaces to remove this warning.我也遇到过类似的问题,对我来说错误是混合缩进:找到空格。
解决方案:在带有 Pydev 的 Eclipse 中,Source 菜单 -> 将制表符转换为空格制表符。
I've faced similar issue, for me the error was Mixed Indentation: Spaces found.
Solution: In Eclipse with Pydev, Source menu -> Convert tabs to space-tabs.