Sublime Forum

Automatic indentation width

#1

Hi all,
Im working a lot with PHP files, and I have my indentation set to tabs, all my code is manually indented with tabs.

The problem is that some files load with a tab width of 4, and some load with a tab width of 2.

I would like all files to have a default indentation width of 4. These are my settings which don’t seem to work:

	"detect_indentation": true,
	"tabSize": 4,
	"translate_tabs_to_spaces": false,
	"tab_size": 4,
0 Likes

#2

Can you provide a sample file whose indentation is set to tab/2 by ST?

0 Likes

#3

Yes, let me figure out how I can attach a file to these posts

0 Likes

#4

Please see link:
https://www.dropbox.com/s/b9bap38tudtpng7/Sample.zip?dl=0

It’s a .php file which always opens with an indentation width of 2

0 Likes

#5

I’ve file an issue report on https://github.com/sublimehq/sublime_text/issues/5865

1 Like

#6

Thank you!

0 Likes

#7

Try setting "detect_indentation": false,.
It should open with tab size 4

1 Like

#8

The staff says this is as designed. I think you should fix the mixed indentation instead.

1 Like

#9

Specifically that sample is very clearly using mixed indentation with a space indentation of 2. The most correct way to load that file is using tabs for indentation with a tab size of 2 to match the parts not using tabs. Otherwise said file would display as:

/* width */
::-webkit-scrollbar {
	width: 10px;
	height: 5px;

}

/* Track */

::-webkit-scrollbar-track {

  background: #F9F9F9; 

}
1 Like

#10

Ah, well that at least resolves it for me - I have removed the spaces and inserted tabs for those lines and finally all pages load with correct indentation.

Thank you all.

0 Likes