Turn off auto formatting for json files in Visual

2020-01-30 07:13发布

问题:

I have checked my preference multiple times and ensured that all options related to format-on-save are set to false. And yet everytime I save a .json file I see my file getting formatted.

回答1:

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!!!!)



回答2:

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   
    }
}


回答3:

I am using below version Visual Studio Code Editor and reached to turn off by following way.

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

Follow these steps > CTRL+SHIFT+P > Type Settings > Select Preferences: Open User Settings

now follow these image instruction.

Save All > Restart Visual Studio Code Editor, Hope it may help many one.



回答4:

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

{
    "editor.formatOnSave": false
}