Eclipse 错误缩进警告

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10093519/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 18:00:40  来源:igfitidea点击:

Eclipse bad indentation warning

pythoneclipsewarnings

提问by Intra

I am using PyDev perspective. I get a "bad indentation" warning in python files. I am using two spaces for indent and eclipse seems to want me to use 4.

我正在使用 PyDev 视角。我在 python 文件中收到“错误缩进”警告。我使用两个空格作为缩进,而 eclipse 似乎希望我使用 4。

How to set the indentation I want so this warning goes away?

如何设置我想要的缩进使这个警告消失?

回答by Fabio Zadrozny

You have to change the tab length that PyDev uses at:

您必须更改 PyDev 在以下位置使用的选项卡长度:

window > preferences > pydev > editor > tab length

窗口 > 首选项 > pydev > 编辑器 > 标签长度

回答by Chris

Do Control+A to select all. Then go under the "source" menu tab and select "correct indentation".

按 Control+A 全选。然后转到“源”菜单选项卡下并选择“正确缩进”。

Source: currently have Eclipse open.

来源:目前已打开 Eclipse。

回答by andrew

Warning:

警告:

Bad indentation (2 spaces)

错误的缩进(2 个空格)

Solution:

解决方案:

  1. CTRL A(select all code in current file)

  2. Source -> Convert tabs to space-tabs[In main menu bar]

  3. Write 2

  1. CTRL A(选择当前文件中的所有代码)

  2. 源 -> 将制表符转换为空格制表符[在主菜单栏中]

  3. 写2