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?

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.

Comment actions Permalink

Thanks, .editorconfig was the reason :)

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.

Comment actions Permalink


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


Comment actions Permalink

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

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 🙃

Comment actions Permalink

I gave up on the ( TAB ) indent for right indent on IntelliJ with Vim plugin; my fallback is to mouse select multiple lines and indent them to the right with a ( SHIFT + > ) combination.   This works for IntelliJ 2019.2 on a Mac.


Please sign in to leave a comment.