Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The 'Black' formatter - Python

I just started using the 'Black' formatter module with Visual Studio Code. 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...

So, is there an Black argument that I could add to Visual Studio Code which solves this problem?

like image 626
Muhammad Hawash Avatar asked Feb 01 '26 02:02

Muhammad Hawash


1 Answers

You can use the --skip-string-normalization option at the command line, or in your Visual Studio Code options.

See The Black code style, Strings.

For example:

{
    ...
    "python.formatting.provider": "black",
    "python.formatting.blackArgs": [
        "--skip-string-normalization",
        "--line-length",
        "100"
    ]
    ...
}
like image 131
FlipperPA Avatar answered Feb 03 '26 04:02

FlipperPA



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!