From ffff63da41b897f60732c6e0686c7841e80b54a7 Mon Sep 17 00:00:00 2001 From: gregorni Date: Sat, 9 Sep 2023 17:50:13 +0200 Subject: [PATCH] Formatter: Handle lists with only 1 item correctly --- blueprintcompiler/formatter.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/blueprintcompiler/formatter.py b/blueprintcompiler/formatter.py index e509396..ededc3f 100644 --- a/blueprintcompiler/formatter.py +++ b/blueprintcompiler/formatter.py @@ -143,6 +143,13 @@ class Format: WHITESPACE_AFTER.append(",") NEWLINE_AFTER.remove(",") + if last_not_whitespace != ",": + current_line = current_line[:-1] + commit_current_line( + 1, + ) + current_line = "]" + indent_levels -= 1 commit_current_line( 1,