Sublime Forum

Detect Indentation Setting Being Overwritten By A File

#1

I am working on a project where tab size is supposed to be 4 and tabs should not be spaces. I updated my Preferences.sublime-settings file to include

"detect_indentation": "false",
"tab_size": 4,
"translate_tabs_to_spaces": false,

When I open a new file these settings are set to how I want and everything works. However, if I open an existing file (scss or html) that has indentations as 2 spaces, my Sublime settings are overwritten and indentations change to 2 spaces. If I click View > Indentation I see that Tab Size is set to 2 and Indent Using Spaces is enabled, even though my preferences should be the opposite of that.

How can I force Sublime Text to honor my indentation preferences and not be overridden by another file. I would assume that Sublime is detecting the indentations on the page, but I’ve turned that setting off.

Here is my preferences file showing that things should be working:

Here are the messed up settings for a scss file. All I did was open it:

Thanks in advance for any help.

0 Likes

#2

I’ve been fighting with this issue for months now, and just discovered that my detect_indentation setting was getting overridden somewhere (I haven’t spent the time to track down exactly where).

I was able to fix it by setting detect_indentation to false in my current project file.

{ "settings": { "detect_indentation": false, ...

To see if you’re seeing the same thing, close and re-open the problem file, then run the following in the console:

view.settings().get("detect_indentation"); view.settings().get("tab_size")

Before the fix and without reopening the file, the above command printed the following:

False 2

Which was a bit confusing, but after reopening the file it became apparent why the tab size was being set to 2:

True 2

After the fix, it printed what I expected,

False 4

Edit: I’m using ST3 build 3083, but iirc this has been a problem since at least build 3065.

0 Likes