mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Formatter: No newline between comments and opening tokens
This commit is contained in:
parent
2851dffe06
commit
91e00ee6ac
1 changed files with 6 additions and 2 deletions
|
@ -45,6 +45,7 @@ class LineType(Enum):
|
|||
BLOCK_OPEN = 1
|
||||
BLOCK_CLOSE = 2
|
||||
CHILD_TYPE = 3
|
||||
COMMENT = 3
|
||||
|
||||
|
||||
class Format:
|
||||
|
@ -142,7 +143,7 @@ class Format:
|
|||
indent_levels += 1
|
||||
commit_current_line(
|
||||
not (
|
||||
prev_line_type == LineType.CHILD_TYPE
|
||||
prev_line_type in [LineType.CHILD_TYPE, LineType.COMMENT]
|
||||
or last_added_char in OPENING_TOKENS
|
||||
),
|
||||
LineType.BLOCK_OPEN,
|
||||
|
@ -167,11 +168,14 @@ class Format:
|
|||
indent_decrease=True,
|
||||
)
|
||||
|
||||
elif str_item == ";" and len(end_str) > 0:
|
||||
elif str_item == ";":
|
||||
commit_current_line(
|
||||
two_newlines=prev_line_type == LineType.BLOCK_CLOSE
|
||||
)
|
||||
|
||||
elif item.type == tokenizer.TokenType.COMMENT:
|
||||
commit_current_line(line_type=LineType.COMMENT)
|
||||
|
||||
else:
|
||||
commit_current_line()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue