Sublime Forum

Python Indentation Preferences Ignored for some files

#1

I’m using Sublime 2.0.1 an Mint Linux distribution.

My preferences are fairly simple, and set indentation to always be ‘2’.

However, I have a couple of Python files (out of a much larger Python project) for which the indentation is always set to 4. I can manually change the indentation for the file each time I open it, but that’s a pain.

All of the problematic files are name “test_foo.py”. If I take a problematic file and copy it to “foo.py”, then problem will NOT appear. If I copy a problematic file to “test_bar.py”, the problem WILL appear. By removing chunks of code, I’ve narrowed it down to the following code being able to reproduce the problem if in a file named test_foo.py.

class TestStatus(TestStatusBase): def test_notification_double_change_no_url(self): status = self._create_status({ 'int': 2 }) d = status.createNotification(revision=1) status.set('status://int', 3) status.set('status://int', 4) d.addCallback(self.assertEquals, { 'revision': 3, 'int': 4, }) return d

0 Likes

#2

Did you check this pref?

// Set to false to disable detection of tabs vs. spaces on load "detect_indentation": true,

0 Likes

#3

I wasn’t explicitly set detect_indentation one way or the other. Setting it to false fixes the problem.

So, thanks! But, I’m surprised it would pick out that example. The pattern I’m using is 2 space indention, but 4 spaces for something wrapped because of line length.

0 Likes

#4

It’s explicitly set in the default prefs.

0 Likes