我想对Python文件使用黑色格式化程序,但不想对JSON设置使用黑色格式化程序
我在我的settings.json中设置了以下内容:
"python.formatting.provider": "black",
"editor.formatOnSave": true,
我尝试通过向settings.json添加以下内容来使用--exclude标记:
"python.formatting.blackArgs": [
"--exclude /*\\.json/"
],
这相当于使用black --exclude /*\.json/
的命令行调用
我也试过了
"python.formatting.blackArgs": [
"--exclude /*\\.json/"
],
根据这篇文章:VS Code Python + Black formatter arguments - python.formatting.blackArgs
但是,它仍在格式化my settings.json
Black不格式化JSON。发生的事情是VS代码有自己的JSON格式化程序,这就是格式化
settings.json
的原因。您是否打开了设置,如"editor.formatOnSave"
打开了?如果是这样的话,听起来您希望将其范围仅限于Python文件,例如:相关问题 更多 >
编程相关推荐