You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently researching Black as our default formatter, but, I'm having some edge cases that don't format well and I want to know if there's a way to get the result I want.
Black's documentation partially explores my problem, I have a dictionary expression spread horizontally, and I want to keep it that way since I'm expecting lines to be added, e.g.:
# Black would keep this as-is because of the trailing commaTRANSLATIONS= {
"en_us": "English (US)",
"pl_pl": "polski",
}
But in my case the dictionary is inside a list comprehension:
(issue) 826 introduced the concept of a magic trailing comma... (some text removed for brevity)
However, there's issues with it so far. It doesn't yet work on nested collections. Worse yet, in those cases it leaves trailing commas behind when a collection ends up compressed into one line. We need to fix those edge cases to make it generally dependable.
As I know of, there isn't an open pull request about fixing this behaviour.
I'm currently researching Black as our default formatter, but, I'm having some edge cases that don't format well and I want to know if there's a way to get the result I want.
Black's documentation partially explores my problem, I have a dictionary expression spread horizontally, and I want to keep it that way since I'm expecting lines to be added, e.g.:
But in my case the dictionary is inside a list comprehension:
Which Black collapses, regardless of the trailing comma, like so:
Is there a way of telling Black to retain the horizontal structure in these cases?
The text was updated successfully, but these errors were encountered: