You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This becomes more problematic when used with tslint or javascript code with eslint, because on different systems we can see one winning over the other randomly i.e. sometimes the case is indented, sometimes it's not (eslint rule says do not indent).
Reacted by Tobias Lindgren, Graeme Wicksted, Franco Lazzarino, Yin Zhong, jeffreymkabot, Keishi Asai, Josh Tynjala, tt-sport-mobile, Christian Passet, David Dix and 48 more
Reacted by tt-sport-mobile, Christian Passet, jeffreymkabot, David Dix, Mokhtar, Kenji Siu, phkorn, VersBinarii, Cameron Sanchez, Bryan Dartout and 2 more
Andrei Neculau (@andreineculau) It has been almost half a year, is there any news on this? I suggest adding a setting (configurable in settings.json) for this, and making the default the new behavior (same indent level for switch and case, one more indent for statement in a case). Thanks!
I'm programming in C and I'm quite happy with how the autoformat formats the code (it's reasonably close to our coding standard, and MISRA guidelines). However, it is desired in my case that there are indents for switch case statements.
What I obtain now after pressing ALT+SHIFT+F:
What I would like:
And, ideally, the "case" keywords should be the same color as "switch"'s (although, if I remove the brackets after "case" the "case" word does become the expected color.
I'd want a setting made for this specific issue because of some cases of people wanting indent or not.
I'm one of the people who wants indenting like
instead of
since it is in every way less confusing for me to look at. I use Java in another IDE and Node.js with vscode and it'd be nice if I could see my switch case setup look like my Java ones (case is indented)
using 1.25.1
edit: oof i didn't actually format the second picture properly and this time i used the keybind for reformatting
This is really a severe issue for me using autoformat in VS Code, so I cannot use autoformat due to this bug. And for me, one of the main tasks of IDE is to do code autoformat. IMO it's a major failure of VS Code. All mature IDEs have configurable indentations.
Reacted by TerraTech, Chris Chapman, Jonathan A. Frisco, stijn7621, yasimsek, Robson Oliveira dos Santos, Kẹo, mciudoiu, Max, James Zhang and 2 more
I would be happy to look at a PR adding a formatter setting for this. Implementer be warned; our indenter code (“SmartIndenter” 🙄) is not the easiest to work with.
Are you volunteering? All the other “N years” commenters have been pretty quiet since I marked it “Help Wanted.” I thought for sure somebody would have given this a shot by now. 😄
Reacted by Jimmie Tyrrell, dcwong and Ryan Cavanaugh
Andrew Branch (@andrewbranch) Needs help here. The code worked, but I'm not sure if there are more test cases that can be added. I don't really know what is behind the tests folder. It's not like using a testing framework.
switch case auto-completion is still indented, log still ends with ; and so on.
I know that we can add custom snippets and make our necessary changes there, but couldn't vscode apply the user configurations to auto completions as well?
a-pav It's strange if none of these settings are applied. Either you do something wrong (e.g. wrong settings file path), or it seems like a different VS Code bug. Mind that there are workspace settings and user settings and the workspace settings overrides the user settings. Check how these settings appears in File > Preferences > Settings.
The mentioned settings are applied when I use editor.action.formatDocument command (or when I paste a code snippet from another source.) But, the settings are not applied when I use the auto-completion feature to spawn a full blown switch-case for example.
The aforementioned settings are placed in my user settings.json and this is what I get auto-completing on switch keyword in a .js file inside a brand new workspace:
Ah, I see, I do not know much about VS Code IntelliSense settings. It's possible to create own code snippets and use them in IntelliSense. But you are right the default IntelliSense should formatted according to your settings. Fill seaparate bug for it, I think it should be in VSCode repo itself.
Activity
vscode: disable javascript formatter, rely on eslint. see microsoft/T…
vscode: disable javascript formatter, rely on eslint. see microsoft/T…
vscode: disable javascript formatter, rely on eslint. see microsoft/T…
vincenzovitale commentedon Feb 21, 2018
Hi guys,
any news on this?
kenjisiu-ibmhk commentedon Mar 11, 2018
Andrei Neculau (@andreineculau) It has been almost half a year, is there any news on this? I suggest adding a setting (configurable in
settings.json) for this, and making the default the new behavior (same indent level forswitchandcase, one more indent for statement in acase). Thanks!andreineculau commentedon Mar 11, 2018
I have no news. Running with a disabled tsformatter. The issue is marked with "awaiting more feedback" but not sure from who.
maxcurzi commentedon Apr 3, 2018
I'm programming in C and I'm quite happy with how the autoformat formats the code (it's reasonably close to our coding standard, and MISRA guidelines). However, it is desired in my case that there are indents for switch case statements.
What I obtain now after pressing ALT+SHIFT+F:

What I would like:

And, ideally, the "case" keywords should be the same color as "switch"'s (although, if I remove the brackets after "case" the "case" word does become the expected color.
Is that possible?
VSCode 1.21.1
Sanae6 commentedon Aug 4, 2018
I'd want a setting made for this specific issue because of some cases of people wanting indent or not.


I'm one of the people who wants indenting like
instead of
since it is in every way less confusing for me to look at. I use Java in another IDE and Node.js with vscode and it'd be nice if I could see my switch case setup look like my Java ones (case is indented)
using 1.25.1
edit: oof i didn't actually format the second picture properly and this time i used the keybind for reformatting

dingcang commentedon Jan 9, 2019
hi guys, how is the progress
ricardolpd commentedon Apr 9, 2019
I guess this has a really low priority, as its annoying but not a big deal. Does anyone from the vscode have an expected release for this?
xmedeko commentedon Sep 20, 2019
This is really a severe issue for me using autoformat in VS Code, so I cannot use autoformat due to this bug. And for me, one of the main tasks of IDE is to do code autoformat. IMO it's a major failure of VS Code. All mature IDEs have configurable indentations.
12 remaining items
andrewbranch commentedon Oct 15, 2021
I would be happy to look at a PR adding a formatter setting for this. Implementer be warned; our indenter code (“SmartIndenter” 🙄) is not the easiest to work with.
itzmanish commentedon Aug 23, 2022
Almost 5 years later, same issue no fix 🙄.
andrewbranch commentedon Aug 23, 2022
Are you volunteering? All the other “N years” commenters have been pretty quiet since I marked it “Help Wanted.” I thought for sure somebody would have given this a shot by now. 😄
donaldnevermore commentedon Apr 7, 2023
I'll have a try.
donaldnevermore commentedon Apr 11, 2023
Andrew Branch (@andrewbranch) Needs help here. The code worked, but I'm not sure if there are more test cases that can be added. I don't really know what is behind the
testsfolder. It's not like using a testing framework.a-pav commentedon Aug 24, 2024
What is the equivalent setting for
javascript?I have
"typescript.format.indentSwitchCase"but no
"javascript.format.indentSwitchCase"xmedeko commentedon Dec 3, 2024
a-pav I have created new issue for JavaScript microsoft/vscode#235085 Please, vote for it if it still affects you.
a-pav commentedon Oct 25, 2025
Ondrej Medek (@xmedeko) Sorry, (Edit: I removed my original comment since it became irrelevant by my later observation that follows.)
I noticed that auto-completions do not respect the settings I've made in
settings.json, Like with these in place:switchcase auto-completion is still indented,logstill ends with;and so on.I know that we can add custom snippets and make our necessary changes there, but couldn't vscode apply the user configurations to auto completions as well?
xmedeko commentedon Oct 27, 2025
a-pav It's strange if none of these settings are applied. Either you do something wrong (e.g. wrong settings file path), or it seems like a different VS Code bug. Mind that there are workspace settings and user settings and the workspace settings overrides the user settings. Check how these settings appears in File > Preferences > Settings.
a-pav commentedon Oct 27, 2025
Ondrej Medek (@xmedeko) I'm strictly talking about the auto-completions feature.
The mentioned settings are applied when I use
editor.action.formatDocumentcommand (or when I paste a code snippet from another source.) But, the settings are not applied when I use the auto-completion feature to spawn a full blown switch-case for example.The aforementioned settings are placed in my user
settings.jsonand this is what I get auto-completing onswitchkeyword in a.jsfile inside a brand new workspace:Note that if I cut-paste this exact switch block or use the
formatDocumentcommand on the file, both the indentations and the semicolons are removed.To add another example, auto-completing on
logkeyword also gives:xmedeko commentedon Oct 27, 2025
Ah, I see, I do not know much about VS Code IntelliSense settings. It's possible to create own code snippets and use them in IntelliSense. But you are right the default IntelliSense should formatted according to your settings. Fill seaparate bug for it, I think it should be in VSCode repo itself.