From 0d767601f59dbe3e700047f6bc3937daa346c148 Mon Sep 17 00:00:00 2001 From: Brad Lewis <22850972+BradLewis@users.noreply.github.com> Date: Mon, 25 Aug 2025 21:10:53 -0400 Subject: Correctly format types with a long value decl --- src/odin/printer/visit.odin | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/odin/printer/visit.odin b/src/odin/printer/visit.odin index 1adc276..2b948a5 100644 --- a/src/odin/printer/visit.odin +++ b/src/odin/printer/visit.odin @@ -340,13 +340,12 @@ visit_decl :: proc(p: ^Printer, decl: ^ast.Decl, called_in_stmt := false) -> ^Do rhs = cons_with_nopl(rhs, visit_exprs(p, v.values, {.Add_Comma}, .Value_Decl)) } else if len(v.values) > 0 && v.type != nil { - rhs = cons_with_nopl( - rhs, - cons_with_nopl( - text(" :" if p.config.spaces_around_colons else ":"), - visit_exprs(p, v.values, {.Add_Comma}), - ), - ) + if v.type != nil { + lhs = cons_with_nopl(lhs, text(":")) + } else { + lhs = cons(lhs, text(":")) + } + rhs = cons_with_nopl(rhs, visit_exprs(p, v.values, {.Add_Comma})) } else { rhs = cons_with_nopl(rhs, visit_exprs(p, v.values, {.Add_Comma}, .Value_Decl)) } -- cgit v1.2.3