Formatter: Handle lists with only 1 item correctly

This commit is contained in:
gregorni 2023-09-09 17:50:13 +02:00
parent 41042b0a78
commit ffff63da41

View file

@ -143,6 +143,13 @@ class Format:
WHITESPACE_AFTER.append(",") WHITESPACE_AFTER.append(",")
NEWLINE_AFTER.remove(",") NEWLINE_AFTER.remove(",")
if last_not_whitespace != ",":
current_line = current_line[:-1]
commit_current_line(
1,
)
current_line = "]"
indent_levels -= 1 indent_levels -= 1
commit_current_line( commit_current_line(
1, 1,