diff --git a/src/dfmt/ast.d b/src/dfmt/ast.d index 1d530ae..a2055d1 100644 --- a/src/dfmt/ast.d +++ b/src/dfmt/ast.d @@ -1896,7 +1896,10 @@ extern (C++) class FormatVisitor : SemanticTimeTransitiveVisitor { write(s.ident.toString()); write(':'); - newline(); + if (config.dfmt_compact_labeled_statements) + write(' '); + else + newline(); if (s.statement) writeStatement(s.statement); } diff --git a/src/dfmt/formatter.d b/src/dfmt/formatter.d index d17ccfc..7081c03 100644 --- a/src/dfmt/formatter.d +++ b/src/dfmt/formatter.d @@ -33,9 +33,9 @@ bool format(string source_desc, ubyte[] buffer, File.LockingTextWriter output, Config* formatterConfig) { initDMD(); - auto module_ = parseModule(source_desc); + auto module_ = parseModule(source_desc)[0]; scope v = new FormatVisitor(output, formatterConfig); - v.visit(module_[0]); + v.visit(module_); return true; }