From 864caada43c4b5379401a1479d12caefa35d5116 Mon Sep 17 00:00:00 2001 From: Prajwal S N Date: Fri, 12 Jan 2024 12:23:31 +0530 Subject: [PATCH] feat: add `dfmt_single_template_constraint_indent` Signed-off-by: Prajwal S N --- src/dfmt/ast.d | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/dfmt/ast.d b/src/dfmt/ast.d index 5b5b9d1..76964ab 100644 --- a/src/dfmt/ast.d +++ b/src/dfmt/ast.d @@ -3304,10 +3304,14 @@ extern (C++) class FormatVisitor : SemanticTimeTransitiveVisitor case TemplateConstraintStyle.conditional_newline_indent: useTempBuf = true; depth++; + if (config.dfmt_single_template_constraint_indent) + depth++; break; case TemplateConstraintStyle.always_newline_indent: newline(); depth++; + if (config.dfmt_single_template_constraint_indent) + depth++; break; case TemplateConstraintStyle.conditional_newline: useTempBuf = true; @@ -3332,10 +3336,11 @@ extern (C++) class FormatVisitor : SemanticTimeTransitiveVisitor if (!conditionalNewline()) buf.put(' '); writeTempBuf(); - depth--; - break; + goto case; case TemplateConstraintStyle.always_newline_indent: depth--; + if (config.dfmt_single_template_constraint_indent) + depth--; break; case TemplateConstraintStyle.conditional_newline: if (!conditionalNewline())