I sometimes have the same problem. VSCode just suddenly faints and completely ignores any indentation settings that I'm talking about, although it was a fingerprint of the same file as it was all day.
I have editor.tabSize set to 2 (and also editor.formatOnSave set to true). When VSCode obfuscates the file, I use the options at the bottom of the editor to change the type and size of the indentation, in the hope that something will work, but VSCode insists on actually using indentation of size 4.
To fix? Restart VSCode. It should return with an indent status showing something wrong (in my case, 4). For me, I had to change the setting and then save it in order to actually make the changes, but this is possible due to my editor.formatOnSave parameter.
I did not understand why this happens, but for me it is usually when I edit a nested object in a JS file. This will suddenly make a very strange indentation inside the object, although I worked in this file for a while, and it was indented just fine.
MrOBrian Aug 09 '17 at 18:30 2017-08-09 18:30
source share