Update

Solution A:

Press Ctrl+Shift+P

Then type Format Document With...

At the end of the list click on Configure Default Formatter...

Now you can choose your favorite code beautifier from the list.

If Format Document With... is not available:

Open a file in Visual Studio Code (the extension of the file is not important can be .js, .html, .txt, etc...) then repeat Solution A again.

Solution B:

Windows: go to file -> preferences -> settings
Mac: go to code -> preferences -> settings

in the search bar tpye format, on the left side, click on Text Editor, the very first item on the right side is Editor: Default Formatter from the dropdown you can pick any document formatter which you've installed before.

Answer from S.Saderi on Stack Overflow
🌐
Reddit
reddit.com › r/vscode › for the life of me, i cannot get vscode to format my code like it used to. please help. i am losing my mind.
For the life of me, I cannot get VSCode to format my code ...
March 17, 2023 -

For the life of me, I cannot get VSCode to format my code like it used to. Please help. I am losing my mind.


I've googled and come up empty.

I've tried:

  • Reinstalling

  • Enable/disable various extensions

  • Went through ALL format settings suggested (default formatter, etc)

  • (This includes format on save, etc)

My code is in C#.

It worked perfectly fine until I had to refresh windows due to a separate issue. It removed all of my programs installed on C: and I had to reinstall VSCode. Since then, whenever I save, NOTHING gets formatted. It is a pain in the ass to format without it. Please help.

Edit: Reinstalled .NET, now C# formatter works but Prettier does not.. at least it's something, I guess?

An accurate depiction of my mental state.

EDIT: Came back to VS code randomly, without updating, and it resolves itself.

I am sorry, this is clearly a 'knowledge of the ancients' situation. If you got here via google, I am afraid I cannot help you.

Top answer
1 of 9
336

Update

Solution A:

Press Ctrl+Shift+P

Then type Format Document With...

At the end of the list click on Configure Default Formatter...

Now you can choose your favorite code beautifier from the list.

If Format Document With... is not available:

Open a file in Visual Studio Code (the extension of the file is not important can be .js, .html, .txt, etc...) then repeat Solution A again.

Solution B:

Windows: go to file -> preferences -> settings
Mac: go to code -> preferences -> settings

in the search bar tpye format, on the left side, click on Text Editor, the very first item on the right side is Editor: Default Formatter from the dropdown you can pick any document formatter which you've installed before.

2 of 9
56

If we are talking Visual Studio Code nowadays you set a default formatter in your settings.json:

  // Defines a default formatter which takes precedence over all other formatter settings. 
  // Must be the identifier of an extension contributing a formatter.
  "editor.defaultFormatter": null,

Point to the identifier of any installed extension, i.e.

"editor.defaultFormatter": "esbenp.prettier-vscode"

You can also do so format-specific:

"[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[sass]": {
    "editor.defaultFormatter": "michelemelluso.code-beautifier"
},

Also see here.


You could also assign other keys for different formatters in your keyboard shortcuts (keybindings.json). By default, it reads:

{
  "key": "shift+alt+f",
  "command": "editor.action.formatDocument",
  "when": "editorHasDocumentFormattingProvider && editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly"
}

Lastly, if you decide to use the Prettier plugin and prettier.rc, and you want for example different indentation for html, scss, json...

{
    "semi": true,
    "singleQuote": false,
    "trailingComma": "none",
    "useTabs": false,

    "overrides": [
        {
            "files": "*.component.html",
            "options": {
                "parser": "angular",
                "tabWidth": 4
            }
        },
        {
            "files": "*.scss",
            "options": {
                "parser": "scss",
                "tabWidth": 2
            }
        },
        {
            "files": ["*.json", ".prettierrc"],
            "options": {
                "parser": "json",
                "tabWidth": 4
            }
        }
    ]
}
Discussions

How to disable automatic formatting options in vscode?
I’m referring especially to the indentation and the stripping of trailing semicolons, which I find a bit annoying tbh, but I wonder how to disable any of the automatic formatting settings in vscode? I have looked through the settings but couldn’t find anything obviously standing out. More on discourse.julialang.org
🌐 discourse.julialang.org
0
January 25, 2022
[Solved] Modify vscode code formatter (how it tidy code) with {}
Hi there! I have setup vscode and platformio (in replacement of atom) and it works great. There is only one little thing I find a bit annoying. I use ctrl+shift+i to tidy my code (on ubuntu), shortcut are different on other platform (as far as I found on a forum, I didn’t test on win/mac): ... More on community.platformio.org
🌐 community.platformio.org
1
0
December 17, 2019
Visual Studio Code is Auto Formatting even with all Settings Disabled
I have the same issue, I found out it's the Microsoft C# extension that causes this for me. Have you tried disabling all extensions? Then enable only the C# extension? It might be some new update?? More on reddit.com
🌐 r/vscode
24
21
May 16, 2025
Hey, is there a way to extract code formatter settings from VS in order to use them in VScode ?
.editorconfig file is understood by both. Although it doesn't guarantee that the outcome is the same. More on reddit.com
🌐 r/VisualStudio
4
0
March 11, 2024
🌐
DEV Community
dev.to › twigman08 › help-setting-up-vscode-formatting-1kf2
Help Setting Up VSCode Formatting - DEV Community
April 20, 2021 - Well this is a really good thing to be aware of - mine is set to none (and working). I'll also note that recently I had an issue where when copying my prettierrc and eslintrc.js files from one VS Code window to a new project's window required a restart (Code & Yarn) before it picked up with changes properly.
🌐
Microsoft Learn
learn.microsoft.com › en-us › visualstudio › ide › code-styles-and-code-cleanup
Code Style Options and Code Cleanup - Visual Studio (Windows) | Microsoft Learn
January 6, 2026 - For formatting styles, select options under Formatting. For code style preferences associated with Quick Actions and IDE code style rules, select options under General or Naming. Each item in the list shows a preview of the preference when you ...
🌐
Julia Programming Language
discourse.julialang.org › tooling › vs code
How to disable automatic formatting options in vscode? - VS Code - Julia Programming Language
January 25, 2022 - I’m referring especially to the indentation and the stripping of trailing semicolons, which I find a bit annoying tbh, but I wonder how to disable any of the automatic formatting settings in vscode? I have looked through…
🌐
Visual Studio Code
code.visualstudio.com › docs › configure › settings
User and workspace settings
November 3, 2021 - A settings URL enables you to navigate directly to a specific setting in the Settings editor from the browser. The URL is in the format vscode://settings/<settingName>, where <settingName> is the ID of the setting you want to navigate to.
🌐
Visual Studio Code
code.visualstudio.com › docs › csharp › formatting-linting
Formatting and Linting
November 3, 2021 - You can format your C# source code using the C# Dev Kit extension, a lightweight extension to enhance your C# development experience in Visual Studio Code. Navigate to File > Preferences > Settings (⌘, (Windows, Linux Ctrl+,)) to customize ...
Find elsewhere
🌐
Built In
builtin.com › articles › vscode-c-formatter-settings
VS Code C Formatter Settings Guide | Built In
You can do this by clicking on the gear icon in the lower-left corner of the VS Code window and selecting “Settings.” You can also use the keyboard shortcut “ctrl +” on Windows or “cmd +” on Mac to open the settings editor.
🌐
Medium
medium.com › @kiran.jasvanee › prettier-auto-formatting-in-visual-studio-code-beab1c026b13
Prettier Auto Formatting in Visual Studio Code. | by Kiran Jasvanee | Medium
March 22, 2020 - Select Format Document With and again you will be asked for few options. Select Prettier — Code Formatter and your file will be formatted. ... Usually, I choose to go to settings using Command Palette, Command+Shift+P to open it.
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-format-code-with-prettier-in-visual-studio-code
Format Code with Prettier in Visual Studio Code: Setup Guide | DigitalOcean
August 1, 2025 - Here’s how to integrate Prettier and ESLint in Visual Studio Code for a seamless development experience. Prettier handles formatting (spaces, line breaks, indentation, etc.) ESLint handles code quality (syntax errors, best practices, anti-patterns) Without proper setup, ESLint and Prettier can conflict; for example, ESLint might enforce one rule, and Prettier might override it.
🌐
Visual Studio Code
code.visualstudio.com › docs › python › formatting
Formatting Python in VS Code
November 3, 2021 - Open a Python file in VS Code. Right-click on the editor to display the context menu. Select Format Document With.... Select Configure Default Formatter... from the drop-down menu.
🌐
Sentry
sentry.io › sentry answers › vs code › format code in visual studio code
Format code in Visual Studio Code | Sentry
To format the contents of the current file, we can either use the shortcut Ctrl+Shift+I (Command+Shift+I on macOS) or bring up the command palette with Ctrl+Shift+P (Command+Shift+P on macOS) and then search for and execute “Format Document”. VS ...
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
Formatting Toggle - Visual Studio Marketplace
October 3, 2023 - Extension for Visual Studio Code - A VS Code extension that allows you to toggle formatting settings ON and OFF with a simple click.
🌐
Visual Studio Code
code.visualstudio.com › docs › editing › codebasics
Basic editing
November 3, 2021 - Format Selection (⌘K ⌘F (Windows, Linux Ctrl+K Ctrl+F)) - Format the selected text. You can invoke these from the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)) or the editor context menu.
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
Prettier - Code formatter - Visual Studio Marketplace
January 21, 2026 - Extension for Visual Studio Code - Code formatter using prettier
🌐
YouTube
youtube.com › watch
Fix Code Formatting in VSCode | Code Formatter Settings - YouTube
If code formatting is not proper, you need to look into code formatter settings in code editor. Here is how I fixed an annoying code formatting issues in my ...
Published   May 16, 2024
🌐
Reddit
reddit.com › r/vscode › visual studio code is auto formatting even with all settings disabled
r/vscode on Reddit: Visual Studio Code is Auto Formatting even with all Settings Disabled
May 16, 2025 -

This started happening this morning and I have no idea why.

Visual Studio Code will format my c# code whenever I hit enter, even though I have all auto formatting disabled with every setting I can find.

Is this like a new bug or some bizarre setting controlled by a keyboard shortcut I hit on accident? Does anyone know what how to fix this?

🌐
Medium
thiraphat-ps-dev.medium.com › the-best-code-formatters-for-vs-code-11704e787f92
The Best Code Formatters for VS Code | by Thiraphat Phutson | Medium
June 3, 2024 - Search for “Prettier — Code formatter” and install it. Configure Prettier to format on save by adding the following settings in your settings.json:
🌐
freeCodeCamp
freecodecamp.org › news › how-to-use-prettier-in-visual-studio-code
How To Use Prettier in Visual Studio Code
March 18, 2024 - Now, you need to type formatter, and then Editor: Default Formatter will pop up on the settings list: ... Now, Prettier is your default code formatter, but you might want to enable Visual Studio Code to automatically format code when you save files.