Increase line width limit to python code when using VS Code and flake8¶
When using VS Code and flake8, line width of python code is by default limited to 79 characters.
For people like me, 79 characters are not enough. How can we increase it?
Update VS Code settings¶
Open VS Code's settings page, and search flake8.args
, press Add Item
and input the following content:
--max-line-length=120
Then the limit will be 120 characters.
Update VS Code configuration file¶
If you prefer to edit json file directly, use this:
{
"flake8.args": [
"--max-line-length=120"
]
}
Notice¶
python.linting.flake8Args
was used in the past and now you should use flake8.args
instead.
According to Migration to Python Tools Extensions, the VS Code team migrated flake8 realted stuff to an extension. This migration caused the changes of flake8 related configuration keys.
This article is originally created by tooli.top. Please indicate the source when reprinting : https://www.tooli.top/posts/vscode_flake8_line_width