Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn off auto formatting for json files in Visual Studio Code

People also ask

How do I turn off auto format in VSCode?

Enable/Disable Format On SaveOpen up VSCode Command Palette by pressing Ctrl + Shift + P. Search and select Open Settings (UI). Just start typing and it will auto-fill. Once there's a match, you can hit enter immediately, or manually click on the right option.

How do I disable beautify in VSCode?

Every single IDE makes this incredibly difficult. Use vs-code default shortcut keys ctrl+k with ctrl+shift+s (windows) for saving without formatting. Alternatively press ctrl+shift+p and search for save without formatting.

How do I change JSON settings in VSCode?

You can open the settings. json file with the Preferences: Open Settings (JSON) command in the Command Palette (Ctrl+Shift+P). Once the file is open in an editor, delete everything between the two curly braces {} , save the file, and VS Code will go back to using the default values.


EDIT: Uninstall the extension, there are many other far better maintained formatters out there (e.g. Beautify)

OK, check if you have installed this extension: "JS-CSS-HTML formatter".

Now if you have, press CTRL+SHIFT+P, type "Formatter" and you should see an option that says Formatter Config.

After selecting that option, a file named formatter.json opens and all you do is edit the property (named onSave) from having true to being false.

Restart vs code and voilà!! It stopped auto formatting. (yay!!!!)


In Visual Studio Code, in order to stop autoformatting only for your json files add the following in settings.json file by opening User Settings - Preferences.

{   
    "[json]": {
        "editor.formatOnSave": false   
    }
}

I am using the below version of VS Code

Version: 1.28.2 (user setup)
Commit: 7f3ce96ff4729c91352ae6def877e59c561f4850
Date: 2018-10-17T00:23:51.859Z
Electron: 2.0.9
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Architecture: x64

And turned it off with the following steps:

  1. CTRL+SHIFT+P
  2. Type Settings
  3. Select Preferences: Open User Settings

Now follow these image instructions:

Click Edit in settings.json Change shown user setting values

  1. Select Save All
  2. Restart VS Code

In VS Code by default Save without Formatting is done by -

on Windows :
STEP 1 : Press CTRL + K then
STEP 2 : Press CTRL + Shift + S

on MAC :
STEP 1 : Press CMD + K then
STEP 2 : Press S


look for Settings.json into "project/.vscode/settings.json"

{
    "editor.formatOnSave": false
}

Worth to note

I like the json formatting that is enabled by default but only wanted to disable it when editing certain files (i.e. I didn't want some massive file json files expanded after formatting).

To do so, I made my change and saved without formatting.

You can go into your vs code keyboard shortcuts and see what Save without formatting is set to. In my case (mac user) it was CMD+K followed by S.