Python Formatter setting in VSCode

While using Black Formatter in VSCode, we can set the maximum line length to prevent some code to be wrapped lines by reformat operation.

Add these in setting.json.

1
2
3
4
5
6
{
    "black-formatter.args": [
        "--line-length",
        "90"
    ]
}

Before:

before

After:

after

About the best line length number, refer to Black document.

In general, 90-ish seems like the wise choice.

comments powered by Disqus