Tabs and Indents are 2 spaces despite setting at 4 spaces

I have Code Style -> Javascript -> Tabs and Indents set to the following.

Tab size: 4
Indent: 4
Continuation indent: 4

I am using WebStorm 9 on Ubuntu 14.4. Tabs come out at 2 spaces when I hit TAB or Enter, not 4 spaces. I cannot find anywhere in the Settings where the tab and indent are set to 2 spaces. I cannot control this. Does anyone have any idea why this is happening?

6 comments
Comment actions Permalink

Hi there,

1) "Settings | Editor | Code Style" -- try disabling "Detect and use existing file indents for editing" in case if you have it enabled (it is by default). NOTE: re-opening file in editor may be required.

2) Do you have any .editorconfig files anywhere in the path of that file? Settings from .editorconfig have priority (will overwrite) over your IDE settings.

47
Comment actions Permalink

Thanks, .editorconfig was the reason :)

12
Comment actions Permalink

Recommendation for an enhancement to IntelliJ

If a user (me) changes the tab settings when an .editorconfig file exists, please tell me that my changes may not be used in the current project because a file (.editorconfig) will override the IDE settings.

I changed every language setting, and was about to post a question titled

Javascript indent change from 2 spaces to 4

when I found this post.

3
Comment actions Permalink

@PatS2265

It's there: "Settings/Preferences | Editor | Code Style"

 

1
Comment actions Permalink

If all solutions aboved you try is not working, try restart IDE.

0
Comment actions Permalink

I somewhat agree with @PatS2265. I know the warning exists in the settings, but because that option is on by default, I never actually saw the warning.

 

On the flip side, that's probably a decent amount of work just to stop bafoons like us from letting our own settings override ourselves 🙃

0

Please sign in to leave a comment.