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 had a look at the code yesterday, and I got the black dev environment locally up and running (great job with that btw, worked on the first try) and set up the test case that is failing, and went into black._format_str_once with a debugger to understand what is happening.
I landed at black.linegen.delimiter_split() where I think the source of the issue lies, but I am not sure about that.
I got to this chunk of code, where the current_line is checked and always the last leave is selected and checked. If I understand correctly by some backwards looping through the line leaves.
When I let the debugger iterate and always check, what current_line.leaves[-1] prints, it always prints the last comment line # "longkey": .... Not sure if I am on the right track though.
The text was updated successfully, but these errors were encountered:
Describe the bug
When running black on a dictionary with a comment, a trailing comma is not set correctly
The example
is being formatted to
where the
,
is missing after"created": ...
To Reproduce
The bug can be reproduced using black.vercel.app
Expected behavior
The expected behavior would create a format with the trailing comma set at the end of the last dictionary entry:
Environment
Additional context
I had a look at the code yesterday, and I got the black dev environment locally up and running (great job with that btw, worked on the first try) and set up the test case that is failing, and went into
black._format_str_once
with a debugger to understand what is happening.I landed at
black.linegen.delimiter_split()
where I think the source of the issue lies, but I am not sure about that.I got to this chunk of code, where the
current_line
is checked and always the last leave is selected and checked. If I understand correctly by some backwards looping through the line leaves.When I let the debugger iterate and always check, what
current_line.leaves[-1]
prints, it always prints the last comment line# "longkey": ...
. Not sure if I am on the right track though.The text was updated successfully, but these errors were encountered: