I use VSCode and when I format the Python code with Black formatter (installed an extension) list's elements are printed one on each line. What's the problem?
From this:
a = [17, 24, 91, 96, 67, -27, 79, -71, -71, 58, 48, 88, 88, -16]
To this:
a = [
17,
24,
91,
96,
67,
-27,
79,
-71,
-71,
58,
48,
88,
88,
-16,
]
Here's settings.json file:
{
"editor.formatOnSave": false,
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
}
}
I tried to use another formatters, but didn't like them
From the Black documentation:
So this is how Black formats code. If it splits your list into separate lines, the expression doesn't fit into one line.
If you want to change the line-length in order to have this particular statement on a single line, use Black's
--line-lengthargument in your VS Code configuration: