Python 在VS代码中,我不';我不想让Black格式化my settings.json

Python 在VS代码中,我不';我不想让Black格式化my settings.json,python,visual-studio-code,vscode-settings,Python,Visual Studio Code,Vscode Settings,我想对Python文件使用黑色格式化程序,但不想对JSON设置使用黑色格式化程序 我在我的settings.json中设置了以下内容: "python.formatting.provider": "black", "editor.formatOnSave": true, "python.formatting.blackArgs": [ "--exclude /*\\.json/" ], 我尝试通过向settings.json添加以下内容来使用-

我想对Python文件使用黑色格式化程序,但不想对JSON设置使用黑色格式化程序

我在我的settings.json中设置了以下内容:

    "python.formatting.provider": "black",
    "editor.formatOnSave": true,
    "python.formatting.blackArgs": [
        "--exclude /*\\.json/"
    ],
我尝试通过向settings.json添加以下内容来使用--exclude标记:

    "python.formatting.provider": "black",
    "editor.formatOnSave": true,
    "python.formatting.blackArgs": [
        "--exclude /*\\.json/"
    ],
这相当于使用
black--exclude/*\.json/

我也试过了

    "python.formatting.blackArgs": [
        "--exclude /*\\.json/"
    ],
基于此帖子:


但是,它仍然在格式化我的设置。json。

Black不格式化json。现在的情况是VS代码有自己的JSON格式化程序,这就是格式化您的设置.JSON。您是否打开了类似于
“editor.formatOnSave”
的设置?如果是这样的话,听起来您希望将其范围仅限于Python文件,例如:

"[python]": {
  "editor.formatOnSave": true
}

Black不格式化JSON。现在的情况是VS代码有自己的JSON格式化程序,这就是格式化您的设置.JSON。您是否打开了类似于
“editor.formatOnSave”
的设置?如果是这样的话,听起来您希望将其范围仅限于Python文件,例如:

"[python]": {
  "editor.formatOnSave": true
}