IDEA ignores configured indentation
I'm using IntelliJ IDEA 2023.2.2 Ultimate Edition (Build #IU-232.9921.47), though this bug started happening to me in 2023.2.1 I believe.
I will be editing a file and suddenly the IDE will just revert to the default indentation settings and stop using the ones that I have configured. It seems to happen more regularly when I'm copying and pasting code or starting a new JSDoc block but I'm not sure exactly. I don't have an EditorConfig and I don't have ‘detect and use existing file indents’ enabled. It doesn't seem to matter whether I'm saving the code style settings to the Project or the IDE, or some custom scheme.
You can see here that the IDE claims the file is using 4 Space indentation:

But if I click that and choose ‘configure indents for Javascript’, you can very clearly see that the Code Style settings are set to 2 Space indentation.

The only way to get it to go back to the configured 2 Space indentation is to fully close the IDE and re-open it, in which case it will work for some time before (seemingly randomly) flipping back to 4 Space indentation.
Please sign in to leave a comment.
Does it help if you disable Settings | Editor | Code Style | Enable EditorConfig support?
It does not, unfortunately. I already have it disabled, and the project does not contain a `.editorconfig`.
Does the issue occur only in JavaScript code?
It has definitely also happened in .vue files before when editing the HTML portions. I can't recall if it has ever happened when editing plain HTML or CSS though. Otherwise the majority of my work is in plain, framework-less Javascript files (.js, .mjs) where the problem occurs most frequently.
Does WEB-62411 look like your case?
The symptoms look very similar to what is being described there, though not exactly. At least in my case, I can hit Ctrl+Alt+L and it will use the configured 2 Space indentation if the IDE has been freshly opened. At some point when it flips back to the unconfigured 4 Space indentation, hitting Ctrl+Alt+L will format the whole file with 4 Space indentation though. Could well be the same root cause though.
Does it help if you disable Settings | Editor | Code Style | Detect and use existing file indents for editing?
As I mentioned in my original post, that is already disabled:
Unfortunately, the issue is not reproducible here. Please share a sample project with the code style you are using, the logs (Help | Collect Logs and Diagnostic Data) and the exact steps to reproduce it at https://youtrack.jetbrains.com/issue/WEB-62411 so that we can investigate further and fix it.
You can also check if the issue persists with the default settings: File | Manage IDE Settings | Restore Default Settings…: https://i.imgur.com/kbrkC7w.png.