黑色格式化程序-Python

问题描述

我刚开始在VSCode中使用Black Formatter模块,一切都进行得很好,直到我发现它在我的代码中已经使用了单引号而不是单引号。.

那么,我可以在VSCode中添加一个黑色参数来解决此问题吗?

谢谢。

解决方法

您可以在命令行或VSCode选项中使用--skip-string-normalization选项。

查看此处:https://black.readthedocs.io/en/stable/the_black_code_style.html#strings

例如:

{
    ...
    "python.formatting.provider": "black","python.formatting.blackArgs": [
        "--skip-string-normalization","--line-length","100"
    ]
    ...
}

祝你好运!