Skip to content

Commit

Permalink
Fixing repeated new line being added within switch expressions (#1272)
Browse files Browse the repository at this point in the history
  • Loading branch information
belav authored May 31, 2024
1 parent a4dd17d commit e911ae4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,13 @@ class ClassName
// comment
Some.Two => 2,
};

return someValue switch
{
(true, true) => someOtherValue,
(false, false)
or someCondition
=> someValue_____________________________________________________
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ FormattingContext context
if (node.PositionalPatternClause != null)
{
result.Add(
node.Parent is SwitchExpressionArmSyntax or CasePatternSwitchLabelSyntax
node.Parent
is SwitchExpressionArmSyntax
or CasePatternSwitchLabelSyntax
or BinaryPatternSyntax
{
Parent: SwitchExpressionArmSyntax or CasePatternSwitchLabelSyntax
}
? Doc.Null
: Doc.SoftLine,
Doc.Group(
Expand Down

0 comments on commit e911ae4

Please sign in to comment.