[英]The Black Formatter - Python
I just started using the Black Formatter module with VSCode everything was going well till I just noticed that it uses double quotes over single quotes which I already was using in my code.. and it overrode that..我刚开始将 Black Formatter 模块与 VSCode 一起使用,一切进展顺利,直到我注意到它使用双引号而不是我已经在我的代码中使用的单引号..它覆盖了..
So, is there an Black Argument that I could add to VSCode which solves this problem?那么,有没有我可以添加到 VSCode 中的 Black Argument 来解决这个问题?
Thanks.谢谢。
I don't know how it works for you all of that:我不知道它是如何为你工作的:
{
...
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
"--skip-string-normalization"
]
...
}
or或者
{
...
"python.formatting.blackArgs": [
"-S"
],
...
}
I've tried everything and THE ONLY works for me is:我已经尝试了一切,唯一对我有用的是:
"black-formatter.args": ["-S"]
And VSCode for some reason installed via pip install -U black
, don't know it is crucial or not.和 VSCode 由于某种原因通过
pip install -U black
,不知道它是否重要。
You can use the --skip-string-normalization
option at the command line, or in your VSCode options.您可以在命令行或 VSCode 选项中使用
--skip-string-normalization
选项。
See here: https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#strings请参阅此处: https : //black.readthedocs.io/en/stable/the_black_code_style/current_style.html#strings
For example:例如:
{
...
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
"--skip-string-normalization",
"--line-length",
"100"
]
...
}
Good luck!祝你好运!
--skip-string-normalization
or -S
for short --skip-string-normalization
或-S
简称
{
...
"python.formatting.blackArgs": [
"-S"
],
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.