Android Studio Tab/Indent Space Settings Are Not Working (Stuck at 2 space indent)
Asked Answered
C

1

7

I am trying to fix a tab/indent issue with Android Studio.

It is not setting the proper spacing (4) on new lines.

I tried setting the tab, indent, and continuation size to 4 but nothing changes.

enter image description here

Even setting crazy values has no effect

enter image description here

Do you know why I cannot get the spacing to be 4 instead of the 2 it's stuck at?

Coreen answered 13/7, 2016 at 17:51 Comment(8)
Comparing your values with mine, I can see that every checkbox is unchecked, and I have 4-4-8 as the values for Tab size, indent, continuation indent, respectively. Those were the default values, by the way, and they're working properly. Can you try to mimic my combination and uncheck the checkboxes?Springwood
Yes but when I use the default, new lines are still only indented by 2. Nothing is changing the new line indents.Coreen
i.e. public int[] X = new int[]{1, 3, 5, 7, 9, 11}; is always indented by 2 .. no matter what changes which is making no sense to me.Coreen
Bloody hell, that does not make any sense. Try to restart Android studio (the famous "did you try turning it off and back on") :DSpringwood
I'm more curious if you can make changes to yours and see a difference. If you change the tab level do the methods and new lines move forward by that amount?Coreen
Interestingly enough, I cannot seem to "break" mine. I've set the tab size to 58, and when I click TAB, it moves 4 places. I set the Indent to 20, and I got a tiny message at the top of the file "This file is indented 4 spaces instead of 20" Allowing me to say "Ok" and "Indent with 20".Springwood
Hmm I don't get that message and this is a freshly installed version. Interesting...Are you on the Window client too or the OS one?Coreen
Let us continue this discussion in chat.Springwood
S
9

Go to Settings -> Editor -> Code Style and unmark the checkbox "Enable EditorConfig support".

enter image description here

Stokeontrent answered 2/9, 2016 at 21:22 Comment(1)
In my case it was actually a setting immediately above this one: Detect and use existing file indents for editing. It's not visible in your screenshot, so presumably something that was introduced in a later version. (I'm currently on AS 4.0.2)Cultigen

© 2022 - 2024 — McMap. All rights reserved.