5
votes

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?

3
Go to General->Editors->Text Editors and make sure Insert Spaces for Tabs is checked there too, that might have something to do with it. I have that one and the PyDev one checked and my code completion uses spaces correctly. - TyrantWave

3 Answers

8
votes

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)

0
votes

On mars2 and PyDev 5.1.1 this still occurs to me. I have Replace tabs with spaces when typing checked and Assume tab spacing when file contain tabs unchecked. I had to replace all tabs with spaces to remove this warning.

0
votes

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.