feat: add `dfmt_compact_labeled_statements`

Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
This commit is contained in:
Prajwal S N 2023-12-13 18:40:26 +05:30
parent 07bfe5c208
commit 14024a5725
No known key found for this signature in database
GPG Key ID: 60701A603988FAC2
2 changed files with 6 additions and 3 deletions

View File

@ -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);
}

View File

@ -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;
}