From d669fa14aea007252e88823e5ebed7ded36d4dd4 Mon Sep 17 00:00:00 2001 From: Bela VanderVoort Date: Sun, 27 Feb 2022 09:16:35 -0600 Subject: [PATCH] Format switch statement consistently with other code. Switch was still using SpaceBrace --- .../FormattingTests/TestFiles/SwitchStatements.cst | 3 ++- .../SyntaxPrinter/SyntaxNodePrinters/SwitchStatement.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/SwitchStatements.cst b/Src/CSharpier.Tests/FormattingTests/TestFiles/SwitchStatements.cst index 5f3a5de0b..0cfc297c1 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/SwitchStatements.cst +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/SwitchStatements.cst @@ -81,7 +81,8 @@ public class ClassName switch ( someLongValue + someOtherLongValue_________________________________________________________ - ) { + ) + { default: return; } diff --git a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/SwitchStatement.cs b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/SwitchStatement.cs index daa629d79..af0809d24 100644 --- a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/SwitchStatement.cs +++ b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/SwitchStatement.cs @@ -34,7 +34,7 @@ public static Doc Print(SwitchStatementSyntax node) Doc.SoftLine ), Token.Print(node.CloseParenToken), - Doc.IfBreak(" ", Doc.Line, groupId), + node.Sections.Count == 0 ? " " : Doc.Line, Token.Print(node.OpenBraceToken), sections, Token.Print(node.CloseBraceToken)