feat: add `dfmt_single_template_constraint_indent`

Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
This commit is contained in:
Prajwal S N 2024-01-12 12:23:31 +05:30
parent 325f093091
commit 864caada43
No known key found for this signature in database
GPG Key ID: 60701A603988FAC2
1 changed files with 7 additions and 2 deletions

View File

@ -3304,10 +3304,14 @@ extern (C++) class FormatVisitor : SemanticTimeTransitiveVisitor
case TemplateConstraintStyle.conditional_newline_indent: case TemplateConstraintStyle.conditional_newline_indent:
useTempBuf = true; useTempBuf = true;
depth++; depth++;
if (config.dfmt_single_template_constraint_indent)
depth++;
break; break;
case TemplateConstraintStyle.always_newline_indent: case TemplateConstraintStyle.always_newline_indent:
newline(); newline();
depth++; depth++;
if (config.dfmt_single_template_constraint_indent)
depth++;
break; break;
case TemplateConstraintStyle.conditional_newline: case TemplateConstraintStyle.conditional_newline:
useTempBuf = true; useTempBuf = true;
@ -3332,10 +3336,11 @@ extern (C++) class FormatVisitor : SemanticTimeTransitiveVisitor
if (!conditionalNewline()) if (!conditionalNewline())
buf.put(' '); buf.put(' ');
writeTempBuf(); writeTempBuf();
depth--; goto case;
break;
case TemplateConstraintStyle.always_newline_indent: case TemplateConstraintStyle.always_newline_indent:
depth--; depth--;
if (config.dfmt_single_template_constraint_indent)
depth--;
break; break;
case TemplateConstraintStyle.conditional_newline: case TemplateConstraintStyle.conditional_newline:
if (!conditionalNewline()) if (!conditionalNewline())