diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2023-06-25 15:56:43 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2023-06-25 15:56:43 +0200 |
| commit | 065a0d88b405b043e73a5649cdc56d1317cf1f2f (patch) | |
| tree | 65c8cece98da0dc94f1e73772d71a891180a9792 /src | |
| parent | d4574616e26477ef67d347113a218b16567086c3 (diff) | |
Fix issue with chainings `do` would increase indentation in a block
Diffstat (limited to 'src')
| -rw-r--r-- | src/odin/printer/visit.odin | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/odin/printer/visit.odin b/src/odin/printer/visit.odin index cc491e1..df48bbb 100644 --- a/src/odin/printer/visit.odin +++ b/src/odin/printer/visit.odin @@ -977,6 +977,7 @@ visit_stmt :: proc( set_source_position(p, v.pos) block := visit_block_stmts(p, v.stmts, len(v.stmts) > 1) + comment_end, _ := visit_comments( p, tokenizer.Pos{line = v.end.line, offset = v.end.offset}, @@ -984,6 +985,8 @@ visit_stmt :: proc( if block_type == .Switch_Stmt && !p.config.indent_cases { document = cons(document, block, comment_end) + } else if uses_do { + document = cons(document, cons(block, comment_end)) } else { document = cons(document, nest(cons(block, comment_end))) } |