2

我刚开始使用带有 VSCode 的 Black Formatter 模块,一切都很顺利,直到我注意到它使用双引号而不是我已经在我的代码中使用的单引号......它覆盖了那个......

那么,是否有一个黑色参数可以添加到 VSCode 来解决这个问题?

谢谢。

4

2 回答 2

7

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

见这里:https ://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#strings

例如:

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

祝你好运!

于 2020-10-26T02:31:16.437 回答
0

--skip-string-normalization-S简称

{
    ...

    "python.formatting.blackArgs": [
        "-S"
    ],
    ...
}
于 2021-12-11T18:15:40.787 回答