Skip to content

Commit

Permalink
Fix empty line between try and finally with no catch
Browse files Browse the repository at this point in the history
closes #454
  • Loading branch information
belav committed Oct 13, 2021
1 parent 8bfd431 commit 888ff29
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Src/CSharpier.Tests/FormattingTests/TestFiles/TryStatements.cst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class ClassName
try { }
catch { }

try { }
finally { }

try
{
throw null;
Expand Down Expand Up @@ -52,5 +55,14 @@ class ClassName
{
return;
}

try
{
//something
}
finally
{
// do something
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static Doc Print(TryStatementSyntax node)
AttributeLists.Print(node, node.AttributeLists),
Token.Print(node.TryKeyword),
Block.Print(node.Block),
Doc.HardLine,
node.Catches.Any() ? Doc.HardLine : Doc.Null,
Doc.Join(Doc.HardLine, node.Catches.Select(CatchClause.Print))
};
if (node.Finally != null)
Expand Down

0 comments on commit 888ff29

Please sign in to comment.