From 441a7a38bd3856c08de473cfec8dacb32a4e3016 Mon Sep 17 00:00:00 2001 From: gregorni Date: Tue, 15 Aug 2023 17:48:56 +0200 Subject: [PATCH] Formatter: Insert newline after comments --- blueprintcompiler/formatter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/blueprintcompiler/formatter.py b/blueprintcompiler/formatter.py index eb2a485..b024d93 100644 --- a/blueprintcompiler/formatter.py +++ b/blueprintcompiler/formatter.py @@ -67,7 +67,10 @@ class Format: tokenized_str += item_as_string - if item_as_string in NEWLINE_AFTER: + if ( + item_as_string in NEWLINE_AFTER + or item.type == tokenizer.TokenType.COMMENT + ): tokenized_str += "\n" + (indent_levels * " ") elif item_as_string in WHITESPACE_AFTER: tokenized_str += " "